Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to access DataTable rows, as ordered by DefaultView?

Posted on 2006-11-13
4
Medium Priority
?
257 Views
Last Modified: 2006-11-18
I am not able to influence the construction of a certain DataTable.  To display it's contents, I set an "order by" clause into table1.DefaultView.Sort.  Everything is good in the gui (asp.net DataGrid), but I am having trouble accessing the records programmatically in that same sorted order.

Is there a way to actually sort the records in the DataTable?

Thanks for any help-
VS 2003
0
Comment
Question by:ottenm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 18

Accepted Solution

by:
Elvio Lujan earned 1000 total points
ID: 17932542
no the DefaultView is just a view!... to get the records ordered in the table you need to order in the source
0
 

Author Comment

by:ottenm
ID: 17932756
Then how to access the data using the view (so they come out sorted)?
0
 

Author Comment

by:ottenm
ID: 17932853

Found it, could also use for each:

        Dim v As DataView = table1.DefaultView
        While i < v.Count - 1
            Dim row As DataRowView = v.Item(i)
            Dim val As String = row("ColumnName")
            'etc.
        End While

0
 

Author Comment

by:ottenm
ID: 17932865
What's the right thing to do if you answer your own question?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question