关于UpdatePanel控件不能实现局部刷新的问题

mmhappyfei mmhappyfei 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面是我做的一个例子,因为要用在毕设里,我先做了个实验,代码如下,但是在按了Button后,发现页面还是全部都刷新了。不知是为什么?
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" >
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<fieldset>
<asp:Label ID="labN" runat="server" Style="z-index: 100; left: 100px; position: absolute;top: 63px" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" Style="z-index: 102; left: 141px; position: absolute;top: 63px" Text="Button" OnClick="Button1_Click1" />
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
这是.cs后台文件里Button键的事件。
protected void Button1_Click1(object sender, EventArgs e)
{
labN.Text = "Hello";
}
...全文

相关推荐

评论 13
收藏 已收藏
分享
返回顶部
mmhappyfei
.NET社区 62,273 成员 668,968 内容