DataView sort

G

Guest

hi,
I'm using data grid with allow sort to true. So with user clicks the header
of the column the data is sorted by the column. With the help of hittest I
know that which column was last sorted wether asc or desc.

Now When selecting which row is select & to get the id of the table I use
the following methods :

//get the data source of the grid
DataView dvBooking = (DataView) dgBooking.DataSource;

//Sort the data view with the current grid sort
dvBooking.Sort = strFieldName; //field name to sort

///given below i try to get the value of the with the current row index
//but it returns the value with the default order not with the sorted order
// it seams as if dvBooking.Sort i'm missing something to complete the
dataview sort

dvBooking.Table.DataSet.Tables[0].Rows[dgBooking.CurrentRowIndex].ItemArray.GetValue(7).ToString();

I want to select the row after the sort....

Thanks in advance...

Regards,

das
 
Y

Yunus Emre ALPÖZEN [MCSD.NET]

Try to use dvBooking[0].Row as DataRow..

Sort command does not changes order of the rows in datatable. It just allows
u to sort the view, not datatable...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top