Adding Mutiple Controls Dynamically to the same page when u click a button every time

Posted by Kprathap23 under ASP.NET on 5/9/2012 | Points: 10 | Views : 972 | Status : [Member] | Replies : 1
Hi All,

I am new to Asp.net . i want to add mutiple control dynamically to my page .



How to add multiple controls dynamically when u click a button every time ?
Eg:

I want to add Mutiple Address when u click a button

After page load, default one Address will be there

Address Line 1 TextBox1

Address Line 2 TextBox2

City Text Box3

State DropDown1



if u want to add more address. we click a button Add More.


The above controls ,4 Labels and TextBoxes and DropDown dynamically genereated when u click Add More button




Address Line1 TextBox4

Address Line2 TextBox5

City TextBox6

State DropDown2



Please post the code.

Please Help me !!!

Thanks in advance
K.pratap




Responses

Posted by: Kavi.Sirius on: 5/9/2012 [Member] Starter | Points: 25

Up
0
Down
hi,

page load()
{
if(! ispostback)
{
texbox1.visible=false;
label1.visible=false;
dropdown1.visible=false;
..
}
protected void button1_click()//add more button click event
{
texbox1.visible=true;
label1.visible=true;
dropdown1.visible=true;
}

try this code its will wrok..


Regards
Kavi.n

Kprathap23, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response