标签:
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %> <!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> <link href="Scripts/EasyUI/themes/icon.css" rel="stylesheet" type="text/css" /> <link href="Scripts/EasyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" /> <script src="Scripts/EasyUI/jquery-1.8.0.min.js" type="text/javascript"></script> <script src="Scripts/EasyUI/jquery.easyui.min.js" type="text/javascript"></script> <script src="Scripts/EasyUI/easyui-lang-zh_CN.js" type="text/javascript"></script> <script src="Scripts/Common.js" type="text/javascript"></script> <script src="Scripts/Ajax.js" type="text/javascript"></script> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div id="tabTop" runat="server"> <div id="Div1" title="标签一" runat="server"> <asp:updatepanel ID="Updatepanel1" runat="server"> <ContentTemplate> <table> <tr> <td> <asp:Button ID="btn1" runat="server" Text="点击1" OnClick="Tab1_Button_Click"/> </td> </tr> </table> </ContentTemplate> </asp:updatepanel> </div> <div id="Div2" title="标签二" runat="server"> <asp:updatepanel ID="Updatepanel2" runat="server"> <ContentTemplate> <table> <tr> <td> <asp:Button ID="btn2" runat="server" Text="点击2" OnClick="Tab2_Button_Click" /> </td> </tr> </table> </ContentTemplate> <%-- <Triggers> <asp:AsyncPostBackTrigger ControlID="" EventName="" /> <asp:PostBackTrigger ControlID="" /> </Triggers>--%> </asp:updatepanel> </div> </div> </form> </body> <script type="text/javascript"> $(function () { $(‘#tabTop‘).tabs({ width: $("#tabTop").parent().width() }); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); }); function EndRequestHandler() { //刷新后的操作 return false; } </script> </html>后台:
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Tab1_Button_Click(object sender, EventArgs e) { } protected void Tab2_Button_Click(object sender, EventArgs e) { } }
<httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers>效果例如以下:
这样button事件后,也不会总体刷新页面了,也就攻克了页签自己主动跳转至默认页的问题了。
代码下载:http://download.csdn.net/detail/yysyangyangyangshan/7991493
JavaScript提高:006:ASP.NET使用easyUI TABS标签updatepanel
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/5158610.html