Now you can configure Gaia Ajax both programmatically in C# and through Web.Config. We've introduced our custom ConfigurationSection so that you can modify the behaviour of Gaia more easily.
The first thing you need to do is define the custom ConfigurationSection in web.config. If you want to read more about .NET ConfigurationSections click here for the MSDN documentation on the subject.
1: <configSections>
2: <section
3: name="GaiaAjaxSection"
4: type="Gaia.WebWidgets.GaiaAjaxConfigurationSection"
5: restartOnExternalChanges="true">
6: </section>
7: </configSections>
The next thing you can do is go ahead and implement the configuration section and set the properties you want.
1: <GaiaAjaxSection
2: EnableDefaultTheme="false"
3: EnableJavaScriptInclusion="true"
4: EnableDynamicScriptLoading="false"
5: EnableNestedCssClasses="true">
6: </GaiaAjaxSection>
So what exactly does these options do? Let's have a look at the different property settings and the consequences of implementing them.
1. EnableDefaultTheme
Gaia Ajax offers default theme capabilities so that if you haven't defined a CssClass and imported a style sheet, you will get some basic UI for your controls. Here's an example of Window, Button and Calendar with default themes. If you explicitly set the CssClass either directly or by using Themes or StyleSheetTheme, then the default theme will
not be applied.
2. EnableJavaScriptInclusion
Gaia Ajax automatically embeds all required javascript, but if you prefer to manually include the javascript files you can turn off this setting. Reasons for turning it off could be
- You have done custom concatentation/changes of the javascript files
- You are hosting the javascript files on a remote / cache server
- You want to have direct references instead of the cryptic references
3. EnableNestedCssClasses
All Advanced Gaia Ajax controls are rendered with a set of nested html elements that have defined unique css classes. This greatly simplifies skinning and we've tried to base the document layout according to best practices.
If you don't like our suggested cssclass definitions and would like to override it with your own behaviour you can set this property to false.
Output with nested css classes looks like this ...
1: <div class="default-window" id="Div1">
2: <div class="default-window-tl" id="Window1_header">
3: <div class="default-window-tr">
4: <div class="default-window-tc">
5: </div>
6: </div>
7: </div>
8: <div style="overflow: hidden;" class="default-window-contentwrapper">
9: <div class="default-window-ml" id="Window1_middle">
10: <div class="default-window-mr">
11: <div class="default-window-mc">
Output without nested css classes looks like this ...
1: <div class="default" id="Div1">
2: <div id="Window1_header">
3: <div>
4: <div>
5: </div>
6: </div>
7: </div>
8: <div style="overflow: hidden;">
9: <div id="Window1_middle">
10: <div>
11: <div>
4. EnableDynamicScriptLoading
Gaia Ajax has the option of automatically loading required javascript files on-demand in ajax callbacks. This feature is now turned off by default. Gaia Ajax 3.5 will automatically embed all javascript in one single file and include that file. If you still want to enable the dynamic script loading capabilities you can turn this feature on. Great, hopefully you see that custom configuration sections simplify configuration of your ASP.NET / Gaia Ajax application.
Here's an example of how dynamic script inclusion looks like in FireBug
If you want to programmatically changes these values you can access them through code.
Just access the singleton instance on GaiaAjaxConfiguration and set the properties yourself.
These features are just some of the goodies coming up in Gaia Ajax 3.5.