5

I have placed a user control inside update panel after doing asynchronous postback of page associated js file of that user control is not working so that is there any method to exclude a control from updatepanel in another word i don't want to post that user control.

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

3 Answers 3

13

Use a PostBackTrigger to perform exclusion rather than having to specify a large number of includes.

<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>
Sign up to request clarification or add additional context in comments.

Comments

0

Set UpdateMode=Conditional and provide exclusive Triggers for the UpdatePanel.

See: http://msdn.microsoft.com/en-us/library/bb386454.aspx

Comments

0

you must add some controls in code behind and in the right event and register it for exclusion(postback) instead and AsyncPostBack which is a ajax call.

ScriptManager.GetCurrent(this).RegisterPostBackControl(btnAdd);

https://stackoverflow.com/a/23036830/184572

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);
        }

    }

look for another similar page which excludes all the controls in a gridview

http://www.aspsnippets.com/Articles/Assign-PostBack-Trigger-Full-PostBack-for-LinkButton-inside-GridView-within-AJAX-UpdatePanel-in-ASPNet.aspx

private void RegisterPostBackControl()
{
    foreach (GridViewRow row in GridView1.Rows)
    {
        LinkButton lnkFull = row.FindControl("lnkFull") as LinkButton;
        ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkFull);
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.