AJAX之UpdatePanel 篇
2011-05-19 13:50
253 查看
前台:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="WebApplication1.test2" %>
<!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" ID="updatePanel2">
<ContentTemplate>
<asp:TextBox ID="txtCompanyCd" runat="server" OnTextChanged="txtChanged" AutoPostBack="true"></asp:TextBox>
<asp:TextBox ID="txtUserNm" runat="server" ></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtCompanyCd" EventName="textChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
后台:
protected void txtChanged(object sender, EventArgs e)
{
txtUserNm.Text = "test";
}
错误提示的时候,注意要用:
ScriptManager.RegisterStartupScript(this.updatePanel2, this.GetType(), "sucess", "alert('登録完了しました。')", true);
不能用: this.ClientScript.RegisterStartupScript(GetType(), "getUserInfo", “alert(3434)”, true);
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="WebApplication1.test2" %>
<!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" ID="updatePanel2">
<ContentTemplate>
<asp:TextBox ID="txtCompanyCd" runat="server" OnTextChanged="txtChanged" AutoPostBack="true"></asp:TextBox>
<asp:TextBox ID="txtUserNm" runat="server" ></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtCompanyCd" EventName="textChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
后台:
protected void txtChanged(object sender, EventArgs e)
{
txtUserNm.Text = "test";
}
错误提示的时候,注意要用:
ScriptManager.RegisterStartupScript(this.updatePanel2, this.GetType(), "sucess", "alert('登録完了しました。')", true);
不能用: this.ClientScript.RegisterStartupScript(GetType(), "getUserInfo", “alert(3434)”, true);
相关文章推荐
- ASP.NET - UpdatePanel 控件概述 AJAX
- 解决AJAX中使用UpdatePanel后再用Response.Write();等无法弹出对话框问题
- 【ASP.NET】Ajax下UpdatePanel和Timer的综合应用
- ASP.NET Ajax UpdatePanel 刷新時的淡出淡入效果
- ASP.NET Ajax UpdatePanel 刷新時的淡出淡入效果
- [ASP.NET AJAX]How to register javascript functions after UpdatePanel updated
- Ajax的UpdatePanel内无法弹出窗口的解决方法
- asp.net ajax 使用updatepanel进行更新后的提示
- asp.net ajax 使用updatepanel进行更新后的提示
- Ajax控件之ScriptManager与UpdatePanel用法 by:凉游浅笔深画眉 / Net7Cracker
- Ajax中的UpdatePanel与Freetextbox兼容问题的初步解决方法
- ASP.NET AJAX - 简单地过一下每个控件(ScriptManager、ScriptManagerProxy、UpdatePanel、 UpdateProgress和Timer)
- AJAX.NET的UpdatePanel应用
- ASP.NET AJAX UpdatePanel下导出Excel报错解决方案
- 用Ajax 1.0制作一个按钮提交后UpdatePanel动画
- AJAX使用了UpdatePanel后无法使用alert弹出脚本
- ASP.NET AJAX Roadmap--Getting Started (4): Introduction to the UpdatePanel Control
- ASP.NET AJAX之UpdatePanel 和JQUERY冲突
- 【AJAX】——UpdatePanel控件的使用
- ASP.NET后台输出js大全,页面顶部、form表单中前面与后面、和UpdatePanel(ScriptManager、AJAX)输出JS