asp.net:从执行异步回发中排除updatepanel中的控件
在异步回发页面后,我在更新面板中放置了一个用户控件,该用户控件的相关js文件不起作用,因此有没有任何方法可以从updatepanel中排除控件?换句话说,我不想发布该用户控件asp.net:从执行异步回发中排除updatepanel中的控件,asp.net,asp.net-ajax,Asp.net,Asp.net Ajax,在异步回发页面后,我在更新面板中放置了一个用户控件,该用户控件的相关js文件不起作用,因此有没有任何方法可以从updatepanel中排除控件?换句话说,我不想发布该用户控件 <asp:UpdatePanel ID="upPnlAnswerList" runat="server"> <ContentTemplate> // another code that required to placed inside upda
<asp:UpdatePanel ID="upPnlAnswerList" runat="server">
<ContentTemplate>
// another code that required to placed inside updatepanel
<div id="miancontainer" class="containerr"
<klmsuc:Share ID="shareUserControl" runat="server" />
// another code that required to placed inside updatepanel
</div>
//另一个需要放置在updatepanel中的代码
设置UpdateMode=Conditional并为UpdatePanel提供独占触发器
见:
使用PostBackTrigger执行排除,而不必指定大量包含
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:LinkButton ID="lnkExport" runat="server" OnClick="lnkExport_Click" Text="Export Data"></asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="lnkExport" />
</Triggers>
</asp:UpdatePanel>
您必须在code behind和right事件中添加一些控件,并将其注册为排除(回发)和AsyncPostBack,这是一个ajax调用
ScriptManager.GetCurrent(this.RegisterPostBackControl(btnAdd)强>
查找另一个类似的页面,该页面排除gridview中的所有控件
protected void grdExpense_RowCreated(object sender, GridViewRowEventArgs e)
{
LinkButton btnAdd = (LinkButton)e.Row.Cells[0].FindControl("btnAdd");
if (btnAdd != null)
{
ScriptManager.GetCurrent(this).RegisterPostBackControl(btnAdd);
}
}
private void RegisterPostBackControl()
{
foreach (GridViewRow row in GridView1.Rows)
{
LinkButton lnkFull = row.FindControl("lnkFull") as LinkButton;
ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkFull);
}
}