frenchie frenchie - 2 months ago 8
Javascript Question

Run Callback after Gridview Sort

I'm sorting a gridview inside an update panel. When the user clicks on the column header, the gridview resorts itself fine. However, after the sort, I' like to run a javascript function called MyScript.

How do I do that?

Thanks.

Answer

Attach an OnSorted event to the GridView:

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