首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

updatepanel无刷新页面解决方法

2012-10-18 
updatepanel无刷新页面html xmlnshttp://www.w3.org/1999/xhtml head runatservertitle无标题

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 />
  &nbsp;
  </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 试试

热点排行