开发者

Run Callback after Gridview Sort

开发者 https://www.devze.com 2023-02-08 09:20 出处:网络
I\'m sorting a gridview inside an update panel. When the user clicks on the column header, the gridview resorts itself fine. However, afte开发者_运维问答r the sort, I\' like to run a javascript functi

I'm sorting a gridview inside an update panel. When the user clicks on the column header, the gridview resorts itself fine. However, afte开发者_运维问答r the sort, I' like to run a javascript function called MyScript.

How do I do that?

Thanks.


You could subscribe for the endRequest event on the PageRequestManager.

function EndRequestHandler(sender, args) {
    // the request finished => run your script here
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);


Attach an OnSorted event to the GridView:

void GridView_Sorted(Object sender, EventArgs e)
{
   var myScript = ....
   Page.ClientScript.RegisterClientScriptBlock(GetType(), "afterSort", myScript, true);
}
0

精彩评论

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