读书人

updatepanel无刷新页面解决方法

发布时间: 2012-10-18 13:46:55 作者: rapoo

updatepanel无刷新页面
<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:Label ID="Label2" runat="server" Text="Label" Width="134px"></asp:Label></div>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" /><br />
 
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</form>
</body>
</html>

.cs

protected void Page_Load(object sender, EventArgs e)
{
Label2.Text = DateTime.Now.ToString();
Label1.Text = DateTime.Now.ToString();
}

protected void Button1_Click1(object sender, EventArgs e)
{
Label1.Text = "heheh";

}


我这样写的
怎么不是无刷新的啊

[解决办法]
yes!
[解决办法]
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

UpdateMode="Conditional"> Conditional 改成Always 试试

读书人网 >asp.net

热点推荐