Showing posts with label Dynamically add controls. Show all posts
Showing posts with label Dynamically add controls. Show all posts

Tuesday, June 10, 2008

Dynamically add Controls to webpage

It is important some times to dynamically generate controls for your application .
To do this use the following code given below:

Label l1=new Label();//creating an instance of the control

l1.Text="Code Snippet ";//Defining its properties like text ,width,height ,style etc

l1.Width="100px";

this.Controls.Add(l1);//Adding it to your page or form

This is a very simple code but is as useful .