By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,275 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,275 IT Pros & Developers. It's quick & easy.

DataView sort

P: n/a
Das
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

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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...
--

Thanks,
Yunus Emre ALP÷ZEN
BSc, MCSD.NET
"Das" <Da*@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
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

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.