473,549 Members | 2,723 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sort dataview by column index

is it possible to sort a dataview by a column index?

Instead of this:
dv.Sort = "Id";

I'd like to do this:
dv.Sort = 0; // where 0 is column index

/M
Mar 12 '06 #1
1 3539
Hi wapsiii,

Dataview sort Expression is similar to sql query sort (without ORDER BY). It
takes column name (or names). If you really want to use column index, I
suggest you use following way:

dv.Sort = dv.Table.Column s[col_index].ColumnName;
HTH

Elton Wang

"wapsiii" wrote:
is it possible to sort a dataview by a column index?

Instead of this:
dv.Sort = "Id";

I'd like to do this:
dv.Sort = 0; // where 0 is column index

/M

Mar 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2153
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
9
2085
by: Raymond Lewallen | last post by:
I have a dataview in which the sort property will not sort the dataview. Here's is a simple scenario similar to what I am doing: Class Foo Private Function Retrieve() As DataView ' Returns a DataView with 2 columns and 3 rows Dim ADOHelper As New DAL.ADOHelper Return ADOHelper.GetMyDataview() End
1
3758
by: Das | last post by:
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...
7
2431
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here
5
1434
by: Kurt Schroeder | last post by:
I'm using VS.net. I have created a component with the basic set of database commands. This component returns a record set that is bound to a datagrid. I want to add a dynamic sort, but am not sure how to do this. If the query were on the same webform this would not be a problem, i'd jist add it to the select string. but..... using the...
3
4489
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,...
4
1537
by: G .Net | last post by:
Hi I have a question which I hope you can help with. I am setting the DataSource of a DataGrid to be a DataView. I am sorting the DataView by various fields which include a Date. When I create a new row in the DataGrid and set the date to me within the current sort range, the newly created row "jumps" to its correct position in the...
4
8620
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone tell me if this is even possible, and if so, how to do it? If this is completely impossible, how would you suggest going about sorting a ComboBox...
0
7450
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...
0
7720
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. ...
0
7957
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...
0
7809
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...
1
5368
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...
0
5088
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...
0
3500
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...
0
3481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.