Ext.Net 1.2.0_WEB.CONFIG 全局配置属性

WEB.CONFIG 配置例子

   1: <?xml version="1.0"?>
   2: <configuration>
   3:     <configSections>
   4:         <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
   5:     </configSections>
   6:   
   7:     <extnet scriptMode="Release" /> <!-- See Property Options in README.txt -->
   8:   
   9:     <!-- 
  10:         The following system.web section is only requited for running ASP.NET AJAX under Internet
  11:         Information Services 6.0 (or earlier).  This section is not necessary for IIS 7.0 or later.
  12:     -->
  13:     <system.web>
  14:         <httpHandlers>
  15:             <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
  16:         </httpHandlers>
  17:         <httpModules>
  18:             <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
  19:         </httpModules>
  20:     </system.web>
  21:   
  22:     <!-- 
  23:         The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0.
  24:         It is not necessary for previous version of IIS.
  25:     -->
  26:     <system.webServer>
  27:         <validation validateIntegratedModeConfiguration="false"/>
  28:         <modules>
  29:             <add 
  30:                 name="DirectRequestModule" 
  31:                 preCondition="managedHandler" 
  32:                 type="Ext.Net.DirectRequestModule, Ext.Net" 
  33:                 />
  34:         </modules>
  35:         <handlers>
  36:             <add 
  37:                 name="DirectRequestHandler" 
  38:                 verb="*" 
  39:                 path="*/ext.axd" 
  40:                 preCondition="integratedMode" 
  41:                 type="Ext.Net.ResourceHandler"
  42:                 />
  43:         </handlers>
  44:     </system.webServer>
  45: </configuration>

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

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

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

WEB.CONFIG配置

<configSections>
……  <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" ></section>
</configSections>
<extnet ajaxViewStateMode="Enabled" />
<httpHandlers>
……  <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
</httpHandlers>

例子

<%@ Page Language="C#" %>

<%@ 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 id="Head1" runat="server">
    <title></title>

    <script runat="server">
        public string myStr
        {
            get
            {
                if (this.ViewState["myStr"] == null)
                {
                    return string.Empty;
                }
                return this.ViewState["myStr"].ToString();
            }
            set
            {
                this.ViewState["myStr"] = value;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if
              (!X.IsAjaxRequest)
            {
                myStr = "AAAAAAAAAAAAAAAAAAAAAA";
            }
        }
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            this.TextField1.Text = myStr;
        }
    </script>

</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>

 

下载 Demo

你可能感兴趣的:(config)