Dynamic HTML elements

  • Thread starter Thread starter Urs Vogel
  • Start date Start date
U

Urs Vogel

Hi

how do I add HTML elements dynamically to my page? Is there some similar way
like with ASPX controls, or do I have to render them out in a custom
control?

Thanks, Urs
 
Look in System.Web.UI.HtmlControls is probably what you are looking for.
They work just like asp.NET controls.
 
Curt

I build all pages dynamically, and would like, for instance, put some ASP
radio buttons into a group box. I just learned, that I could use FILEDSET as
a container to hold my radio buttons. This works when createing a static
page, but I don't know how to add HTML controls (NOT ASP controls)
dynamically to my page, or how do wrap the code below into HTML opening and
ending tags like <fieldset>...</fieldset>?

RadioButton rbt as new RadioButton();
rbt.Text = uctl.text;
rbt.ID = "ID1";
rbt.Style.Add("style", "Z-INDEX: 100; POSITION: absolute; LEFT: " +
Str(uctl.location.X * zoom) + "px; TOP: " + Str(iTitleHeight + TopOffset +
uctl.location.Y) + "px");
pnl.Controls.Add(rbt);

Any hints? Thanks. Urs.
 
you need a placeholder. If you want to populate the page with somethign from
the code-behind you'll have to put in a placeholder control, or really even
an asp:Label control, and then you can populate it with your html (or
whatever) as you would like from the code-behind....

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
 
Back
Top