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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding 1 control, multiple times to another control

Status
Not open for further replies.

tekkerguy

Programmer
Nov 16, 2005
196
US
I have 3 div'

I'll call them holderdiv, rowdiv, and celldiv.

the structure on a page is supposed to look like this:

Code:
<div id="holderdiv" class="holderdiv" runat="server">
   <div class="rowdiv">
     <div class = "celldiv">
         pulldown
         pulldown
         pulldown
     </div>
     <div class="rowdiv">
     <div class = "celldiv">
         pulldown
         pulldown
         pulldown
     </div>
   </div>
      <div class="rowdiv">
     <div class = "celldiv">
         pulldown
         pulldown
         pulldown
     </div>
     <div class="rowdiv">
     <div class = "celldiv">
         pulldown
         pulldown
         pulldown
     </div>
   </div>
</div>

which basically comes out on the page as two rows of 3 pulldown controls.


I've hardcoded the holder div directly on the page with an id and runat.

in the code behind, I have code that loops through controls and adds three to a celldiv, adds that to the rowdiv, and adds that to the holderdiv.

problem is, if I add 3 to the cell div, then add that to the row, then add 3 more, and add that to the row, etc, it all comes out as just the 3 divs with the cell div holding all of the div. So instead of the above code, it comes out like:

Code:
<div id="holderdiv" class="holderdiv" runat="server">
   <div class="rowdiv">
     <div class = "celldiv">
         pulldown
         pulldown
         pulldown
         pulldown
         pulldown
         pulldown
     </div>
   </div>
</div>

How do I go about adding the section and group div to the header div multiple times instead of it seemingly adding to just one?


Basically add a div to another div say 3 times, so that it shows up in the page as 3 divs in 1 div.

<div>
<div></div>
<div></div>
<div></div>
</div>

 
this would get a better response in the ASP.NET forum

Age is a consequence of experience
 
Figured it out, it was a C# issue.

I created the control before the loop, which isn't an issue, except I put the = new HtmlGenericControl before the loop. So it was just using the same instance.

After I put the new Html... in the loop, it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top