473,772 Members | 2,391 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 3768
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
2168
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
7315
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
2867
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
3453
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
4308
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
4497
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
9619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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
10261
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...
1
10038
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,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5354
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
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.