huby Posted March 30, 2004 Posted March 30, 2004 hello i'm trying to dynamically add a tag to an aspx page. i add labels at runtime using myPanel.Controls.Add(myLabel), and would like to insert "<BR>" between them, to space my data. what object/method should i use ? HtmlTextWriter ? how does that work ? thanx, Huby. Quote there are 10 kinds of people on earth: those who understand binary, and those who don't.
MorningZ Posted March 30, 2004 Posted March 30, 2004 Insert a Literal Control in there easy enough :) Quote If you make it idiot proof, they'll build a better idiot :-)
huby Posted March 30, 2004 Author Posted March 30, 2004 ok thank you ! sorry i know it was a newbie question, but i'm getting into ASP.NET without asy classic ASP background... LiteralControl is easy enough :D i used this syntax : ExpoPanel.Controls.Add(new LiteralControl("<BR>")); is that the shortest/most optimized way of using it ? thank you for the reply ;) Huby. Quote there are 10 kinds of people on earth: those who understand binary, and those who don't.
Moderators Robby Posted March 30, 2004 Moderators Posted March 30, 2004 try... MyPanel.controls.add(new literalcontrol("<br>") Quote Visit...Bassic Software
MorningZ Posted March 30, 2004 Posted March 30, 2004 ok thank you ! sorry i know it was a newbie question, but i'm getting into ASP.NET without asy classic ASP background... LiteralControl is easy enough :D i used this syntax : ExpoPanel.Controls.Add(new LiteralControl("<BR>")); is that the shortest/most optimized way of using it ? thank you for the reply ;) Huby. and i'll just add... that if you are indeed just learning ASP.NET... learning the "shortcut" methods might be hurting you, not helping you... since the "long way" will teach/show you whats going on other than "it just works" (this holds true for me anyways) So like: 'Create a new control that holds a line break Dim litLineBreak As New Literal litLineBreak.Text = "<br />" 'Now add it to the Panel myPanel.Controls.Add(litLineBreak) and with the above, later on you can just re-use "litLineBreak" if you need to add another line break somewhere instead of unceccarily created "New" controls every time hth Quote If you make it idiot proof, they'll build a better idiot :-)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.