Ext.Net web.config全局属性配置

 

WEB.CONFIG 配置例子

<?xml version="1.0"?> <configuration> <configSections> <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" /> </configSections> <!-- EXT.NET GLOBAL CONFIGURATION PROPERTIES directEventUrl : string The url to request for all DirectEvents. Default is "". directMethodProxy : ClientProxy Specifies whether server-side Methods marked with the [DirectMethod] attribute will output configuration script to the client. If false, the DirectMethods can still be called, but the Method proxies are not automatically generated. Specifies ajax method proxies creation. The Default value is to Create the proxy for each ajax method. Default is 'Default'. Options include [Default|Include|Ignore] ajaxViewStateMode : ViewStateMode Specifies whether the ViewState should be returned and updated on the client during an DirectEvent. The Default value is to Exclude the ViewState from the Response. Default is 'Default'. Options include [Default|Exclude|Include] cleanResourceUrl : boolean The Ext.NET controls can clean up the autogenerate WebResource Url so they look presentable. Default is 'true'. Options include [true|false] clientInitDirectMethods : boolean Specifies whether server-side Methods marked with the [DirectMethod] attribute will output configuration script to the client. If false, the DirectMethods can still be called, but the Method proxies are not automatically generated. Default is 'false'. Options include [true|false] gzip : boolean Whether to automatically render scripts with gzip compression. Only works when renderScripts="Embedded" and/or renderStyles="Embedded". Default is true. Options include [true|false] scriptAdapter : string Gets or Sets the current script Adapter. Default is "Ext". Options include [Ext|jQuery|Prototype|YUI] renderScripts : ResourceLocationType Whether to have the Ext.NET controls output the required JavaScript includes or not. Gives developer option of manually including required <script> files. Default is Embedded. Options include [Embedded|File|None] renderStyles : ResourceLocationType Whether to have the Ext.NET controls output the required StyleSheet includes or not. Gives developer option of manually including required <link> or <style> files. Default is Embedded. Options include [Embedded|File|None] resourcePath : string Gets the prefix of the Url path to the base ~/Ext.Net/ folder containing the resources files for this project. The path can be Absolute or Relative. scriptMode : ScriptMode Whether to include the Release (condensed) or Debug (with inline documentation) Ext JavaScript files. Default is "Release". Options include [Release|Debug] sourceFormatting : boolean Specifies whether the scripts rendered to the page should be formatted. 'True' = formatting, 'False' = minified/compressed. Default is 'false'. Options include [true|false] stateProvider : StateProvider Gets or Sets the current script Adapter. Default is 'PostBack'. Options include [PostBack|Cookie|None] theme : Theme Which embedded theme to use. Default is "Default". Options include [Default|Gray|Slate] quickTips : boolean Specifies whether to render the QuickTips. Provides attractive and customizable tooltips for any element. Default is 'true'. Options include [true|false] --> <extnet theme="Gray" /> <!-- The following system.web section is only requited for running ASP.NET AJAX under Internet Information Services 6.0 (or earlier). This section is not necessary for IIS 7.0 or later. --> <system.web> <httpHandlers> <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" /> </httpHandlers> <httpModules> <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" /> </httpModules> </system.web> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules> <remove name="ScriptModule" /> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" /> </modules> <handlers> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler" /> </handlers> </system.webServer> </configuration>

如何让EXT.NET支持视图变量ViewState


根据以上的说明,我们可以对 EXT.NET 进行很多配置。

比如,让 EXT.NET 支持视图变量。默认情况下,EXT.NET不保存页面变量,但是可以通过配置EXT.NET改变这点,毕竟有时使用ViewState还是挺方便的。


WEB.CONFIG配置


view plain copy to clipboard print ?
  1. <configuration>  
<configuration>
view plain copy to clipboard print ?
  1.  <configSections>  
  2.    <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" ></section>  
  3.  </configSections>  
  4.  <extnet ajaxViewStateMode="Enabled" />  
  5. </configuration>  
  6. <httpHandlers>  
  7.  <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />  
  8. </httpHandlers>  
<configSections> <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" ></section> </configSections> <extnet ajaxViewStateMode="Enabled" /> </configuration> <httpHandlers> <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" /> </httpHandlers>

例子

view plain copy to clipboard print ?
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="AM.Web.Pages.Test" %>  
  2.   
  3. <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  5. <html xmlns="http://www.w3.org/1999/xhtml">  
  6. <head runat="server">  
  7.     <title></title>  
  8. </head>  
  9. <body>  
  10.     <form id="form1" runat="server">  
  11.     <ext:ResourceManager ID="ResourceManager1" runat="server" />  
  12.     <ext:Button ID="Button1" runat="server" OnDirectClick="Button1_Click" Text="ViewState">  
  13.     </ext:Button>  
  14.     <ext:TextField ID="TextField1" runat="server" Text="">  
  15.     </ext:TextField>  
  16.     </form>  
  17. </body>  
  18. </html>  
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="AM.Web.Pages.Test" %> <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <ext:ResourceManager ID="ResourceManager1" runat="server" /> <ext:Button ID="Button1" runat="server" OnDirectClick="Button1_Click" Text="ViewState"> </ext:Button> <ext:TextField ID="TextField1" runat="server" Text=""> </ext:TextField> </form> </body> </html>
view plain copy to clipboard print ?
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Web;  
  5. using System.Web.UI;  
  6. using System.Web.UI.WebControls;  
  7. using Ext.Net;  
  8.   
  9. namespace AM.Web.Pages  
  10. {  
  11.     public partial class Test : System.Web.UI.Page  
  12.     {  
  13.         public string myStr  
  14.         {  
  15.             get  
  16.             {  
  17.                 if (this.ViewState["myStr"] == null)  
  18.                 {  
  19.                     return string.Empty;  
  20.                 }  
  21.                 return this.ViewState["myStr"].ToString();  
  22.   
  23.             }  
  24.             set  
  25.             {  
  26.                 this.ViewState["myStr"] = value;  
  27.             }  
  28.         }  
  29.         protected void Page_Load(object sender, EventArgs e)  
  30.         {  
  31.             if (!X.IsAjaxRequest)  
  32.             {  
  33.                 myStr = "AAAAAAAAAAAAAAAAAAAAAA";  
  34.             }  
  35.         }  
  36.         protected void Button1_Click(object sender, DirectEventArgs e)  
  37.         {  
  38.             this.TextField1.Text = myStr;  
  39.         }  
  40.     }  

你可能感兴趣的:(Ext.Net web.config全局属性配置)