Solved

Looping through a dataview object

Posted on 2006-10-23
2
1,167 Views
Last Modified: 2010-05-18
I am trying to loop through a dataview and find the information inside of the actual cell. The only information I can currently grab, is the name of the column.  Some help that is...  If I could just do something like Response.Write(dvTopMenu.Rows[i].Columns[3].Text)  then I could make this work.  

Here is pseudocode of what I am trying to accomplish:
---------------------------------------------------------------------------------
for (int i = 0; i < dvTopMenu.Count; i++)
{
    // Pseudocode here
    if(dvTopMenu's column [3] = strPagePath.LastIndexOf("/") + 1))
    {
        dlTopMenu.SelectedIndex = i;
        break;
    }
}
---------------------------------------------------------------------------------

Thank you for your help,

Stank
0
Comment
Question by:stankstank
2 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 125 total points
ID: 17790021
foreach(DataRow dr in YourDataView) {
   Console.WriteLine(dr["columnname"]);
}
0
 

Author Comment

by:stankstank
ID: 17790310
Thanks gregory, that worked perfectly. :)

-Stank
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now