标签:des blog http io os 使用 ar for 文件
原文作者:杨友山
原文地址:http://blog.csdn.net/yysyangyangyangshan/article/details/39679823
前面也说过在asp.net中前后前交互的问题。使用了ajax.js的方法:$.post和$.ajax。
http://blog.csdn.net/yysyangyangyangshan/article/details/22755007和<%@ 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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:updatepanel runat="server">
<ContentTemplate>
<asp:TextBox ID="txtTime" runat="server" Width="150px"></asp:TextBox>
<asp:Button ID="btnTime" runat="server" Text="获取系统时间" OnClick="Btn_Time_Click"/>
</ContentTemplate>
</asp:updatepanel>
</div>
</form>
</body>
</html>后台: public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Btn_Time_Click(object sender, EventArgs e)
{
this.txtTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}web.config配置<?xml version="1.0"?>
<configuration>
<appSettings />
<connectionStrings />
<system.web>
<compilation debug="true">
</compilation>
<!--
通过 <authentication> 节可以配置
安全身份验证模式,ASP.NET
使用该模式来识别来访用户身份。
-->
<authentication mode="Windows" />
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节
可以配置相应的处理步骤。具体而言,
开发人员通过该节可配置要显示的 html 错误页,
以代替错误堆栈跟踪。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<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>
</system.web>
</configuration>这样一来,按钮的click事件后,页面就不会整体刷新了。而updatepanel要注意写法:<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:updatepanel runat="server">
<ContentTemplate>
<!--放置你的控件-->
</ContentTemplate>
</asp:updatepanel>这样不论是简单的textbox,还是对gridview绑定都可以了。标签:des blog http io os 使用 ar for 文件
原文地址:http://blog.csdn.net/yysyangyangyangshan/article/details/39679823