generate textboxes on every click of button

Posted by Rickeybglr under ASP.NET on 7/12/2011 | Points: 10 | Views : 70856 | Status : [Member] | Replies : 5
i need to add multiple email id's in my project. for that i have to generate textboxes at runtime on every click of button. also have to store these emails in database using store procedure




Responses

Posted by: Ndebata on: 7/12/2011 [Member] Starter | Points: 25

Up
0
Down
You can use a gridview with template footer as textbox and button.
When adding a new email id save it to db and bind the gridview.

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

Posted by: Lakn2 on: 7/12/2011 [Member] Starter | Points: 25

Up
0
Down
place one panel or placeholder or literal control in your aspx page
TextBox tb;

static int i=0;
protected void button1_click(object sender,EventArgs e)
{
tb=new textbox();
tb.id=i.tostring();
panel1.controls.add(tb);
or
placeholder1.controls.add(tb);
i++;
}
now you can store textbox values in back end.

}

Thanks&Regards
LakshmiNarayana Nalluri.

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

Posted by: Rickeybglr on: 7/12/2011 [Member] Starter | Points: 25

Up
0
Down
hey this code generate only one textbox at a time ...i need to generate no. of text box on every click of button(for eg: i clicked 5 times a button thn code shud generate 5 textboxes). it would be thankful if u can also provide store procedure for this

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

Posted by: Lakn2 on: 7/12/2011 [Member] Starter | Points: 25

Up
0
Down
hi you can get multiple textboxes with button click by using above code but you can visible only one textbox .to see all textboxes put one break point in code or place one table and each cell put one textbox .ok try it .

Thanks&Regards
LakshmiNarayana Nalluri.

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

Login to post response