Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to declare AccordionPane dynamically 1

Status
Not open for further replies.

Stepyogameup

Programmer
Nov 4, 2008
3
I have to loop a datatable and from the datatable I want to dynamically declare AccordionPane. I tried to do it like this code but it doesn't work. Anyone knows how I declare AccordionPane dynamically.

Code:
    private void CreateWebMenu()
    {
        string mainMenu = string.Empty;
        int i = i++;

        foreach (DataRow dr in mDataTable.Rows)
        {
            [COLOR=red]AccordionPane accPane + i = new AccordionPane();[/color]
            if (mainMenu != dr["DialogName"])
            {
                
            }

            mainMenu = dr["DialogName"];            
        }
    }

How can I solve this problem.
 
something like this
Code:
int index = 0;
foreach (DataRow dr in mDataTable.Rows)
{
   AccordionPane pane = new AccordionPane();
   pane.ID = "pane_" + index++;
   //set pane properties
   TheAccordian.Panes.Add(pane);
}

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top