Dynamic Variables? OR Dynamic Controls

G

Guest

Ello...

What I'm trying to do is have a page layout with x columns by 4 rows. The
first row would be names pulled from a dataset. The second row would be
checkboxes - each being its own checkboxlist (maybe - is there a better way?)
that would be 'associated' with the above picture. The 3rd/4th rows are the
same, with different data.

Now, I'd like to be able to do a for loop, which is easy for the first/third
rows. But when the controls pop up, I'm at a loss for how to do those
without putting in the code to add each control separately.

Any suggestions?
 
S

Scott Allen

Hi teros:

You can use a for loop to loop through controls on a page, or controls
in a section of the page:

foreach(Control c in Controls)
{
// you can test if the control is one you are looking for:
if(c is TextBox)
{
// do some work
}
}

Every control on a webform has a Controls collection of child
controls. You can pick just the collection where you need to examine
each control.

Does this help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

dynamic controls 3
Dynamic Controls 0
Dynamic table with dynamic controls and mySql ... 0
Dynamic Controls 0
Dynamic Controls 1
Dynamic Controls 0
Retaining dynamic controls on postback 1
Dynamic HTML in ASP.NET 3

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top