Question

I have a jquery modal that is being called from a button on my page. When the Webmethod for this button is called, and all logic is complete, I need to refresh several update panels on my page, to reflect the changes that took place in the WebMethod.

I've not used Update Panel much, but i've followed a view examples and am drawing a blank.

In the success portion of my call, i've placed this:

    success: function (msg) {
         $('#ApproveDialog').modal('hide');
         __doPostBack("<%= UpdatePanel1 %>","");

and my update panel is:

       <asp:Button ID="button" runat="server" style="display:none;"/>
        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:GridView ID="grdMessageDate" runat="server"/>                </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="button" EventName="Click"/>
            </Triggers>
        </asp:UpdatePanel>

I've left out part of the Grid, but i have a button in the first col, which is used to display further information.

When i click the button in the grid. this is causing the postback.

How do i call the postback in the success method?

Was it helpful?

Solution

You should be able to postback in the success like so:

__doPostBack("UpdatePanel1","");

or if the updatepanel gets an asp.net formated id:

__doPostBack("<%= UpdatePanel1.ClientID %>","");

Otherwise you could use the hidden button technique (I use this, but don't think it is the most elegant method)

see post: Force a postback in Javascript for UpdatePanel?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top