开发者

jQueryUI dialog, gridview and updatepanel

I'm using jQuery to convert a column of hyperlinks within a gridview into UI dialogs.

This gridview is in an updatepanel, and for one of the dialog's buttons I perform a __dopostback on this updatepanel, which refreshes the changes I've made within the dialog.

It all works rather nicely, apart from one small issue.... that is when the updatepanel posts back and recreates the gridview table with new data.. I lose the dialog functionality!

Previously, I simply had the following:

$('a.createdialog').click(function(e) { <iframe code here>.dialog( { <buttons and other options> } )

and it made sense that, once the gridview was updated, the above will essentially be wiped.

So I put that code into a function, and as well as running this function on t开发者_JAVA技巧he page load I also placed the function into the dialog's button code. This however does not fix the issue... I tried moving where I call this function around from the button to the updatepanel's loading events with registerstartupscript().. again no luck.

any ideas? Cheers :D


Try the live method, description from JQuery Docs: Attach a handler to the event for all elements which match the current selector, now and in the future. The async postback/refresh is killing the handler; live can help in this situation persist the handler.

http://api.jquery.com/live/

$('.clickme').live('click', function() {
  // Live handler called.
});

HTH.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜