473,396 Members | 2,081 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,396 software developers and data experts.

how to find row position after sorting dataview table

Hello,

I set a dataview to a table. Then I bind a currencyManager to the dataview.
I can iterate through the dataview no problem so far. Then I sort the
dataview on a certain field and rebind the currencyManager to the dataview.
I can still iterate through the newly sorted dataview OK. The problem is
that the row order of the underlying table did not change with the sort. Now
the rows are out of order if I want to set a datarow object to the currently
displayed row.

How can I determine what row I am on after doing a sort on a dataview?

Thanks,
Rich
Jun 1 '07 #1
1 2949
Nevermind, I figured it out:

Dim drF() As DataRow
drF = myDataset.Tables("myTable").Select("rowID = " & txtRowID.Text)
dr = drF(0)

rowID is the unique column in myTable. I use the Select method of the
DataTable object to retrieve all rows that have the given RowID (which will
be 1 row in my case since RowID is unique). I collect the returned rows in a
DataRow array, drF. Then I set a datarow object to the first row in drF(0).
"Rich" wrote:
Hello,

I set a dataview to a table. Then I bind a currencyManager to the dataview.
I can iterate through the dataview no problem so far. Then I sort the
dataview on a certain field and rebind the currencyManager to the dataview.
I can still iterate through the newly sorted dataview OK. The problem is
that the row order of the underlying table did not change with the sort. Now
the rows are out of order if I want to set a datarow object to the currently
displayed row.

How can I determine what row I am on after doing a sort on a dataview?

Thanks,
Rich
Jun 1 '07 #2

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

Similar topics

1
by: Dave S | last post by:
Hi, I'm using a datagrid to display contents of a dataset and I've set the datagrid to allow paging and sorting. Rather than re-retrieve from the DB, I store the original dataset in a Session...
9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
4
by: suzy | last post by:
hello. how can i sort data in a dataset? all the examples i have seen on msdn, etc are sorting a dataview. this works fine, but i want to return the results in xml and the dataview doesn't...
3
by: Björn | last post by:
Hi List I´m generating a DataSet using a simple sql select statement. Now my DataSet has several rows with columns(ID,NAME,CAPTION) Now I want to sort the DataSet for column Caption. I can´t...
4
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1,...
6
by: David P. Donahue | last post by:
I've been looking around for ways to sort the rows in a DataTable, and everything seems to point to just changing the Sort property on that DataTable's DefaultView property. That's all well and...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I need to locate a row (or see if it exists) in a table contained in a dataset. The DataView.Find method seems to work OK for one criteria but I need to use 2 criterias. Is there...
6
by: =?Utf-8?B?RGFu?= | last post by:
I am reposting a question from about 3 weeks ago ("sorting capability"). I have an aspx page in which I get the data from a database dynamically, through C# code, by creating a dynamic table...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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...
0
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...
0
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,...

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.