Vinit Patel

How to create multiple textboxes at runtime using class file

Posted on: October 7, 2009


Declare a public string in the partial class of the CS file. like

public string str;

now place the str in the aspx file where you need to create the multiple textboxes like this

<%=str%>

now in the button click event using stringbuilder append the code that is used to create the TextBoxes dynamically like this

StringBuilder sb=new  StringBuilder();

sb.Append(“<asp:TextBox id=”xxx” runat=”server”/>”);

like this u can bind number of TextBoxes.

now assign this “sb” to the “str”

str=sb.ToString();

your Textboxes get created in the aspx file.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Calendar

October 2009
M T W T F S S
« Sep   Dec »
 1234
567891011
12131415161718
19202122232425
262728293031  

Stats Of Blog

  • 6,824 hits

Cluster Map

%d bloggers like this: