Wednesday, March 28, 2012

calling a server side method to rebind and refresh a datalist in updatepanel without a ful

I have 2 datalists:

datalist1 (inside UpdatePanel1)

datalist2 (outside UpdatePanel1)

I have a ImageButton inside the datalist2 & when it is clicked, in the datalist2_ItemCommand event, I am updating some information in the database & calling a DataBind() on datalist1 & then calling an Update() method of UpdatePanel1.

This works fine, but my problem is that because of the datalist2_ItemCommand getting fired, a full postback occurs as well. How do I avoid this? I just want the datalist1 to be refreshed inside the UpdatePanel & not refresh the datalist2 at all.

If I use Web Service method, then I can do the database update in it, but I am unable to access the datalist1 to rebind it and also the UpdatePanel1 to update it.

Can someone please help me.

Thanks

Hi,

You canregister theItemCommand event ofdatalist2as a trigger of the UpdatePanel in whichdatalist1 is contained.

<Triggers>
<asp:AsyncPostBackTrigger ControlID="DataList1" EventName="ItemCommand" />
</Triggers>

Best Regards,


I had logged this issue in another forum my mistake and it got moved in this forum only after I logged it again as a new post (link below):

http://forums.asp.net/p/1180380/2000803.aspx#2000803

Thanks for your help.

No comments:

Post a Comment