insert tag

huby

Freshman
Joined
Feb 20, 2004
Messages
32
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.
 
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 :
Code:
ExpoPanel.Controls.Add(new LiteralControl("<BR>"));
is that the shortest/most optimized way of using it ?

thank you for the reply ;)

Huby.
 
huby said:
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 :
Code:
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
 
Back
Top