Feature Post

Top

ASP.NET: Quick Sort a GridView

How to sort a GridView without hitting the database?

DataView dv = dt.DefaultView;//Your datatable, dt.
dv.RowFilter = "";//Set row filter to none.
if ((strSortBy != null) && (strSortAscending != null))
    dv.Sort = strSortBy/*Column name*/ + " " + strSortAscending /*ASC, for instance.*/;

grd.DataSource = dv;
grd.DataBind();

Happy sorting!