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配置


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

例子

<%@ 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>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;

namespace AM.Web.Pages
{
    public partial class Test : System.Web.UI.Page
    {
        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;
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值