Creating/Removing textboxes on button click

Posted by Mdfaiyaz under ASP.NET on 11/25/2008 | Views : 2278 | Status : [Member] | Replies : 3
Hi, i'm a fresher...learning .Net technology.

I'm doin an example where on button click(one ADD button & on REMOVE button) the textboxes should get generated and removed( i have 3 seperate textboxes)so on button click 3 more textboxes should come up.
A web based application using C#. After entering the data i want to save on clicking save button. Plz provide me the code

Thanks




Responses

Posted by: Jayakumars on: 9/30/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

when you will click save use the code like this

sqlcon.Open();
SqlCommand sqlcmd=new SqlCommand ("insert into tablename values('Jesus');",sqlcon);
sqlcmd.ExecuteNonQuery();


Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com

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

Posted by: Jayakumars on: 9/30/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Please mark as answer Resolved Posts if it helpful to you.

Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com

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

Posted by: Deysomnath on: 11/25/2008 [Member] Starter

Up
0
Down
just toggle the text box ..
suppose u have a 6 text boxes

textbox1
textbox2
textbox3
textbox4
textbox5
textbox6

and two buttons

button1
button2

And you want to display first 3 text boxes on the click of button1 and rest of the textboxes on the click of button2.

Then on click of button1 write the below code

public void button1_click(...)
{
textbox1.visible=true;
textbox2.visible=true;
textbox3.visible=true;

textbox4.visible=false;
textbox5.visible=false;
textbox6.visible=false;

}

and in click event of button2 write the following code


public void button2_click(...)
{
textbox1.visible=false;
textbox2.visible=false;
textbox3.visible=false;

textbox4.visible=true;
textbox5.visible=true;
textbox6.visible=true;

}

you can do the same thing by using javascript too.


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

Login to post response