【问题标题】:updatepanel refresh whole page in asp.net在 asp.net 中 updatepanel 刷新整个页面
【发布时间】:2015-07-21 08:09:35
【问题描述】:
我像这样在我的页面中使用更新面板。
但是当我单击刷新所有页面的按钮时运行我的应用程序。
我不知道我能做些什么来解决这个错误。
即使我在其他页面中使用树视图,当我收到此错误时树视图图标也不显示。
请帮帮我。
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="updPanl" runat="server" RenderMode="Block" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
【问题讨论】:
标签:
asp.net
webforms
updatepanel
【解决方案1】:
试试这个
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="updPanl" ChildrenAsTriggers="true" runat="server" RenderMode="Block" UpdateMode="Conditional" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
protected void Button1_Click(object sender, EventArgs e)
{
updPanl.Update();
}
【解决方案2】:
三天后我今天可以找到这个问题,所以我回答这个问题也许这对其他人有帮助。
我在我的应用程序中使用了例程,所以 webresource 和 scriptresouce 无法在 asp 页面中加载
我使用此代码不路由此资源
routeCollection.Add(new Route("{resource}.axd/{*pathInfo}", new StopRoutingHandler()));