EXT.NET学习笔记(一) 下载配置使用

新公司使用ext.net开发,开始学习该知识:

首先下载ext.net,目前我使用的版本为1.7,该版本免费,基本的功能也够用,使用ext.net进行开发时强烈建议使用VS2015,能便捷的提示,大大的缩短学习和使用时间。

ext.net共包含三个文件:

下载后在工程中将其三个引用。

ext.net官方提供完整的API,详见该地址:http://examples1.ext.net

详细的学习资料参见该博主文章:齐飞 http://youring2.cnblogs.com/

以下是我的个人心得:

首先在web.config中<configuration>添加以下

<!--添加全局配置-->
  <configSections>
    <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
  </configSections>
  
  <extnet scriptMode="Release" />

  <system.web>
    <!--
        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. 经典模式
    -->
    <compilation debug="true" targetFramework="4.0" />
    <httpHandlers>
      <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
    </httpHandlers>
    <httpModules>
      <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
    </httpModules>
    <!--在页面中使用Ext.Net的控件,需要添加针对Ext.Net控件的配置 
    在这里配置后就不需要在每个aspx页面页首都添加配置  
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> -->
    <pages>
      <controls>
        <add tagPrefix="ext" namespace="Ext.Net" assembly="Ext.Net" />
      </controls>
    </pages>
  </system.web>

  <system.webServer>
    <!--经典模式和集成模式共存,还需要再system.webServer节点中添加下面的配置-->
    <validation validateIntegratedModeConfiguration="false" />
    <!--
        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.  集成模式
    -->
    <modules>
      <add
                name="DirectRequestModule"
                preCondition="managedHandler"
                type="Ext.Net.DirectRequestModule, Ext.Net" />
    </modules>
    <handlers>
      <add
                name="DirectRequestHandler"
                verb="*"
                path="*/ext.axd"
                preCondition="integratedMode"
                type="Ext.Net.ResourceHandler" />
    </handlers>

  </system.webServer>
View Code

然后可以开始在页面中使用ext.net了。

在需要使用Ext.Net控件的页面中添加资源引用,就像使用ScriptManager一样,需要在页面中添加如下控件,

  <ext:ResourceManager runat="server"></ext:ResourceManager>

有了这个控件,就等于我们已经在页面中添加了ExtJS的引用。

然后添加如下代码 

<ext:Window runat="server" 
    ID="firstwin" 
    Title="示例窗口" 
    Width="300" 
    Height="200" 
    AutoShow="true">
</ext:Window>

在IE中查看该页面,就能看到一个窗体了。

if (!X.IsAjaxRequest)

当第一次请求页面时(此时为回发),IsAjaxRequest 为 false,之后为 true,因为之后的请求是 Ajax 请求。

原文地址:https://www.cnblogs.com/zlsyl/p/5306765.html