View Code
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <!-- 4 有关如何配置 ASP.NET 应用程序的详细消息,请访问 5 http://go.microsoft.com/fwlink/?LinkId=169433 6 --> 7 8 <configuration> 9 <configSections> 10 <section name="ExtAspNet" type="ExtAspNet.ConfigSection,ExtAspNet" requirePermission="false"/> 11 </configSections> 12 <ExtAspNet EnableBigFont="true" DebugMode="false"/> 13 <appSettings/> 14 <connectionStrings></connectionStrings> 15 <system.web> 16 <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"> 17 <controls> 18 <add assembly="ExtAspNet" namespace="ExtAspNet" tagPrefix="ext"/> 19 </controls> 20 </pages> 21 <httpModules> 22 <add name="ExtAspNetScriptModule" type="ExtAspNet.ScriptModule,ExtAspNet"/> 23 </httpModules> 24 <httpHandlers> 25 <add verb="GET" path="res.axd" type="ExtAspNet.ResourceHandler,ExtAspNet"/> 26 </httpHandlers> 27 <customErrors mode="Off"></customErrors> 28 <compilation debug="true" targetFramework="4.0" /> 29 </system.web> 30 31 </configuration>
web.config中的配置。使用ExtAspNet同时要引用 ExtAspNet.dll 和 Newtonsoft.Json.dll 才能正常使用
View Code
1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ExtAspNetTest.Default" %> 2 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 <html xmlns="http://www.w3.org/1999/xhtml"> 5 <head runat="server"> 6 <title></title> 7 </head> 8 <body> 9 <form id="form1" runat="server"> 10 <ext:PageManager runat="server" ID="man1" /> 11 <div> 12 <ext:Button runat="server" Text="OK" OnClick="btnOK" /> 13 </div> 14 </form> 15 </body> 16 </html>
前台添加一个ext中的button ,添加onclick事件
View Code
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 ExtAspNet; 8 9 namespace ExtAspNetTest 10 { 11 public partial class Default : System.Web.UI.Page 12 { 13 protected void Page_Load(object sender, EventArgs e) 14 { 15 16 } 17 18 protected void btnOK(object sender, EventArgs e) 19 { 20 Alert.Show("Hello World!"); 21 } 22 } 23 }
后台完成事件。显示一个弹出框。运行
一个ajax式的对话框实现了。