Solved

Looping through a dataview object

Posted on 2006-10-23
2
1,168 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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