PDA

View Full Version : Web.config



swallace
Feb 18, 2008, 5:05 PM
Could you post a quick example Web.config that shows where the changes for ScriptManager would go? Thanks.

geoffrey.mcgill
Feb 19, 2008, 1:13 AM
Hi swallace,

Sure thing. The Ajaxian/ExtJS blog posts caught us a bit off guard. We were hoping to have one more day to complete a few of the critical tutorials. I'll have a full Web.config Example/tutorial available within the next few hours.

geoffrey.mcgill
Feb 19, 2008, 10:35 AM
Hi swallace,

The following code demonstrates where to add the global "coolite" configSection to the Web.config. Each of the properties/attributes are listed with a bit of description, optional values and default values.</p>


<?xml version="1.0"?></p>

<configuration>
    <configSections>
      <section name="coolite" type="Coolite.Ext.Web.GlobalConfig"/>
    </configSections></p>

  <!-- COOLITE GLOBAL CONFIGURATION ATTRIBUTES -->
  <!-- cleanResourceUrl = true|false
       The Coolite controls can clean up the autogenerate WebResource Url so they look presentable.
       Default is true -->
 
  <!-- gzip = true|false
       Whether to automatically render scripts with gzip compression.
       Default is true. -->
 
  <!-- scriptAdapter = Ext, jQuery, Prototype, YUI
       Which script adapter to use.
       Default is "Ext" -->
 
  <!-- renderScripts = true|false
       Whether to have the coolite controls output the required JavaScript includes or not.
       Gives developer option of manually including required <script> files.
       Default is true -->
 
  <!-- renderStyles = true|false
       Whether to have the coolite controls output the required StyleSheet includes or not.
       Gives developer option of manually including required <link>/<style> files.
       Default is true -->
 
  <!-- scriptMode = Release, Debug
       Whether to include the Release (condensed) or Debug (with documentation) JavaScript files
       Default is "release" -->
 
  <!-- theme = Default, Gray
       Which embedded theme to use.
       Default is "Default" --></p>

  <coolite
    cleanResourceUrl="true"
    gzip="true"
    scriptAdapter="Ext"
    renderScripts="true"
    renderStyles="true"
    scriptMode="Release"
    theme="Gray"
    /></p>

</configuration>
</p>

The Theme can also be set at a Session level by using the ScriptManager.RegisterSessionTheme() method or directly by setting the "Coolite.Theme" Session value. Setting the Theme in the Session will override a Theme set in the Web.config. </p>

Example</p>


<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Coolite.Web.UI.ScriptManager.RegisterSessionTheme( Coolite.Web.UI.Theme.Gray);
    }
</script>



<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext.Current.Session["Coolite.Theme"] = Coolite.Web.UI.Theme.Gray;
    }
</script>
</p>


I have a detailed tutorial and screencast in the works, but they're not quite done. I'll update this thread once they're ready.</p>

Hope this helps.</p>

swallace
Feb 19, 2008, 12:11 PM
Perfect, thanks!

swallace
Feb 19, 2008, 12:40 PM
Looks like the sample is from an earlier/later version than the 0.3.1.12579 that I'm using.

Here's a change that makes it work:

renderScripts="Embedded"
renderStyles="Embedded"

As given, the example produces the error:

The value of the property 'renderScripts' cannot be parsed. The error is: The enumeration value must be one of the following: None, File, Embedded.

geoffrey.mcgill
Feb 20, 2008, 12:03 AM
Right you are regarding the renderScripts and renderStyles properties. That was my mistake. Both take a ResourceLocationType Enum value with possible options being Embedded, File or None.

Here's the updated Web.config sample.

<?xml version="1.0"?>

<configuration>
<configSections>
<section name="coolite" type="Coolite.Web.UI.GlobalConfig"/>
</configSections>

<!-- COOLITE GLOBAL CONFIGURATION ATTRIBUTES -->
<!-- cleanResourceUrl = true|false
The Coolite controls can clean up the autogenerate WebResource Url so they look presentable.
Default is true -->

<!-- gzip = true|false
Whether to automatically render scripts with gzip compression.
Only works when renderScripts="Embedded" and/or renderStyles="Embedded".
Default is true. -->

<!-- scriptAdapter = Ext, jQuery, Prototype, YUI
Which script adapter to use.
Default is "Ext" -->

<!-- renderScripts = Embedded, File, None
Whether to have the coolite controls output the required JavaScript includes or not.
Gives developer option of manually including required <script> files.
Default is Embedded -->

<!-- renderStyles = Embedded, File, None
Whether to have the coolite controls output the required StyleSheet includes or not.
Gives developer option of manually including required <link> or <style> files.
Default is Embedded -->

<!-- scriptMode = Release, Debug
Whether to include the Release (condensed) or Debug (with imline documentation) Ext JavaScript files.
Default is "Release" -->

<!-- theme = Default, Gray
Which embedded theme to use.
Default is "Default" -->

<coolite
cleanResourceUrl="true"
gzip="true"
scriptAdapter="Ext"
renderScripts="true"
renderStyles="true"
scriptMode="Release"
theme="Gray"
/>

</configuration>




Hope this helps.

geoffrey.mcgill
Feb 23, 2008, 11:40 PM
We found a couple problems when running the Assembly in Medium Trust mode. One was fixed in code and will be available with the next release. The other requires a simple edit to the web.config.

The <code>requirePermission="false"</code> attribute must be applied to the coolite configuration section.

Here's the full revised web.config sample.


<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="coolite" type="Coolite.Ext.Web.GlobalConfig" requirePermission="false" />
  </configSections>
  <!-- COOLITE GLOBAL CONFIGURATION ATTRIBUTES -->
  <!-- cleanResourceUrl = true|false       
       The Coolite controls can clean up the autogenerate WebResource Url so they look presentable.       
       Default is true -->
 
  <!-- gzip = true|false       
       Whether to automatically render scripts with gzip compression.       
       Only works when renderScripts="Embedded" and/or renderStyles="Embedded".      
       Default is true. -->
 
  <!-- scriptAdapter = Ext|jQuery|Prototype|YUI       
       Which script adapter to use.       
       Default is "Ext" -->
 
  <!-- renderScripts = Embedded|File|None      
       Whether to have the coolite controls output the required JavaScript includes or not.      
       Gives developer option of manually including required <script> files.       
       Default is Embedded -->
 
  <!-- renderStyles = Embedded|File|None      
       Whether to have the coolite controls output the required StyleSheet includes or not.      
       Gives developer option of manually including required <link> or <style> files.      
       Default is Embedded -->
 
  <!-- scriptMode = Release|Debug       
       Whether to include the Release (condensed) or Debug (with inline documentation) Ext JavaScript files.      
       Default is "Release" -->
 
  <!-- theme = Default|Gray       
       Which embedded theme to use.      
       Default is "Default" -->
 
  <coolite   
      cleanResourceUrl="true"   
      gzip="true"   
      scriptAdapter="Ext"    
      renderScripts="true"   
      renderStyles="true"   
      scriptMode="Release"   
      theme="Gray"   
      />
</configuration>

You can switch into Medium Trust mode to test by adding adding the following <trust> node to your web.config, within the <system.web> node.


<system.web>
    <trust level="Medium" />
</system.web>

</p>

geoffrey.mcgill
Mar 28, 2008, 3:06 PM
As of version 0.4.1 (http://www.ext.net/download/), we've added several other options for setting each of these global config properties. The following forum post details each of the four methods.

http://forums.ext.net/showthread.php?postid=177.aspx

As well, a new global config property called ResourcePath was added. More information available within the following forum post.

http://forums.ext.net/showthread.php?postid=178.aspx

Hope this helps.

jachnicky
Dec 09, 2008, 1:46 AM
hi,geoffrey

How to change the custom theme by Ajax methods or Ajax events?

geoffrey.mcgill
Dec 09, 2008, 10:28 AM
Hi jachnicky,

It's probably best to start a new thread since your question is a new topic. thx.