473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DataView sort

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
1 3745
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Denzil | last post by:
Hi, I am using the DataView.Sort Property (on a DataView column) to sort the View based on some condition. Now the column that I need to sort contains characters and HTML code that should not...
1
by: anon | last post by:
How does the DataView.Sort method really work under the covers? I know that it sorts a dataview, but what kind of sorting algorhythm is actually used? Thanks.
2
by: Peter S. Guild | last post by:
Hello, I have a simple routine that uses a dataview to hold information. I need to sort these columns by section and then by desc. No matter what I do the dataview will not sort. What am I...
2
by: alAzif | last post by:
Hi everyone. If I have a table T with columns C1 and C2, I would like to know if the following is possible: T.DefaultView.Sort = "C1 ASC, C2 DESC"; If this is not so, I would really...
3
by: nish | last post by:
Hi, I have been working on Sorting within a Datagrid that is created programmatically, so everything is created in the code-behind. I have a Template Column that consists of a Header Template....
5
by: Mike Kline | last post by:
Hi All! I've this strange DataView sort bug and i can't do any sorting activities! Below is my code... ---VB.NET Code--- dvFinal = New DataView(objDataSet.Tables(CON_FinalTable)) Dim...
0
by: seanmayhew | last post by:
Im having a small problem with my Dataview sort. Its sorting correctly on the first character but after thats it seems random so for a state list at the "W's" it looks like this: WA WV WY WI...
3
by: Peter Proost | last post by:
Hi group, I've got this, a dataset which contains ds.tables(0).rows(0).item(0) = "HO" ds.tables(0).rows(1).item(0) = "L1" ds.tables(0).rows(2).item(0) = "L2" ds.tables(0).rows(3).item(0) =...
3
by: gilly3 | last post by:
I have a column in a DataView that contains NaN. When I attempt to Sort on this column, I get: MESSAGE: Index was outside the bounds of the array. SOURCE: System.Data STACKTRACE: at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.