DotnetSparrow
DotnetSparrow

Reputation: 27996

updating updatepanel on checkbox check ( which has client events and is in other updatepanel)

I am working in asp.net application. I have a checkbox and three textboxes inside an updatepanel. I have another updatepanel. I am using Jquery to hide show the textboxes. I want to update the second updatepanel contents as well on first updatepanel's checkbox check/uncheck ( which already has client events) How can I do this ?

I don't want to use __doPostBack('__Page', 'MyCustomArgument'); because it will postback whole page.

Please suggest.

Upvotes: 1

Views: 914

Answers (1)

Crab Bucket
Crab Bucket

Reputation: 6277

I might be misunderstanding your requirements but you can always force the second update panel to refresh from the code behind

SecondPanelId.Update(); 

I could have missed something of course

To force update from javscript then I would try

function forceAJAXPostback()
{
    var prm = Sys.WebForms.PageRequestManager.getInstance(); 
    prm._doPostBack('btnIntheUpdatePanel','');
}

I know you said not _doPostBack - but because you are specifying the button within the update panel it should do the partial postback you require. If there isn't a button then put one on and hide it with css i.e. display:none

This is a good explanation of the technique.

You would also need to ensure that the button is specified as an async trigger in the updatepanel markup

<asp:UpdatePanel> 
<!-- rest of panel -->
<Triggers>         
<asp:AsyncPostBackTrigger ControlID="btnIntheUpdatePanel" EventName="Click" />         
</Triggers> 
</asp:UpdatePanel> 

Upvotes: 1

Related Questions