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

Adding controls @ runtime - How can I put a <BR> between them?

Status
Not open for further replies.

DSect

Programmer
Sep 3, 2001
191
US
Hello -

I have 2 tables that I creat @ run time in my application and I make them appear by doing Page.Controls.Add(myTable)

This works great, but since I am adding 2 tables, I am unable to get a <BR> (line break) between them.

So, by adding them at runtime I'm unable to format the space between them like I could if I had dragged and dropped them onto the page in design view.

Is there a way to add "html" or "text" or something using Page.Controls.Add ? This would also be very useful in the future.

And, just as an affirmation of my technique - am I doing handling this properly considering that I'm creating the elements @ run time? Meaning - Is Page.Controls.Add a good way to add run-tim built controls to a page so they show up @ run time?

Thanks as always!!!
 
Oh boy - This is the second time I'd figured out how to do something right after I'd posted it..

I'd remembered that if I wanted to add HTML or text to a TableCell, I'd do myCell.Controls.Add(New LiteralControl("MY TEXT"))

Ahh - So that works for the page also...

So to do what I wanted to do, I did:
Page.Controls.Add(New LiteralControl("<BR>"))

I'm hoping that is "correct", as it does work..

Thanks again!! It's funny how sometimes all it takes is writing to spur thought.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top