Solved

Looping through a dataview object

Posted on 2006-10-23
2
1,166 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
Comment Utility
foreach(DataRow dr in YourDataView) {
   Console.WriteLine(dr["columnname"]);
}
0
 

Author Comment

by:stankstank
Comment Utility
Thanks gregory, that worked perfectly. :)

-Stank
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

11 Experts available now in Live!

Get 1:1 Help Now