Xpode.com        Click here to Print this article.

How to use ORDERBY on RowFilter in Asp.Net

Requirement: Where Rows need to show Order wise Ascending or descending in code behind. e.g we are receiving a dataset from database and want to show records in ascending or Descending wise on basis of any column. So we will write the column name in sort order.

if (ds.Tables[0].Rows.Count > 0)
DataView dv = new DataView();
dv = ds.Tables[0].DefaultView;
dv.Sort = " AdminMessageId Desc ";
dlAdminMessage.DataSource = dv;


Contributed by:
Rohit kakria
I am software developer

Resourse address on xpode.com

Click here to go on website