Dynamically create controls using stringbuilder

Posted by Shrewdy on Stack Overflow See other posts from Stack Overflow or by Shrewdy
Published on 2010-03-12T13:08:18Z Indexed on 2010/03/12 13:17 UTC
Read the original article Hit count: 450

Filed under:
|
|
|
|

hi,

i have been trying to create controls dynamically on my web page using the StringBuilder class..and i dont quite seem to get through... any help would be appreciated.

i am trying to do this...

StringBuilder sbTest = new StringBuilder(string.Empty);

sbTest.Append("<input type=\"text\" id=\"txt1\" runat=\"server\" />");

Response.Write(sbTest.ToString());

The page for sure displays a TextBox on the browser which is easily accessible through JavaScript...but what i want is the control to be available on the Server Side too...so that when the page is posted back to the server i can easliy obtain the value that has been entered by the user into the textbox.

Can any 1 please help me with this....

thank you so much....

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about dynamically