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 试试