473,837 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DataS ource;

//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.Curre ntRowIndex].ItemArray.GetV alue(7).ToStrin g();

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

Thanks in advance...

Regards,

das

Nov 17 '05 #1
1 3769
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*@discussion s.microsoft.com > wrote in message
news:AD******** *************** ***********@mic rosoft.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.DataS ource;

//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.Curre ntRowIndex].ItemArray.GetV alue(7).ToStrin g();

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
2173
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 be considered when sorting is done. (e.g. -> <B>, <FONT ...>, " , ' , etc...). To illustarte: Example 1
1
282
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
7318
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 doing wrong? Language is C# ..Net framework is 1.1
2
2869
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 appreciate other options you might think of. Table T is not populated from a database. It is created and filled
3
3454
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. The Header Template consists of LinkButtons, so when triggered it will fire an event calling the following function: e.CommandName - contains "Sort1", "Sort2", etc.
5
4311
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 strSort As String = drpOrderBy.Text & " " & drpOrderStyle.Text
0
1120
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 Any help greatly appreciated.
3
5459
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) = "O1" ds.tables(0).rows(3).item(0) = "BR" then I want to sort it using a dataview like this:
3
4499
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 System.Data.Index.Sort(Int32 left, Int32 right) at System.Data.Index.InitRecords() at System.Data.Index..ctor(DataTable table, Int32 indexDesc, DataViewRowState recordStates, IFilter rowFilter)
0
9682
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10875
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10566
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10623
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7806
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7001
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5669
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4040
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3124
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.