Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello i am new in asp.net in my application i want to create 2 dropdownlist and one textbox dynamically and save the to database.

suppose on button click i want to create Dropdown for country,State, And in textbox i want to insert the City name. if i click on button one more time then once again i want to perform same operation means create one more time country,state, and textbox

What I have tried:

Nothing.
Posted
Updated 6-Dec-16 17:00pm
v2
Comments
Suvendu Shekhar Giri 26-Nov-16 10:34am    
Show us what have you tried so far?
Ganesh KP 27-Nov-16 1:30am    
I don't understand the necessity of creating controls dynamically in your situation. Well if you want to create control's dynamically, you can create it and need to save the created controls in a session or some other way and retrieve them on a post back and draw it on your web page.

We can able to give you more suggestions depends on your exact requirements.

Hi,

There is one way,you can create controls dynamically that write button click event in java script. and directly controls plain htmlstring you can append to div where you want to show controls dynamically.

myDiv.InnerHtml = "your html here";


every click you can add dropdown country with id like drpCountry_0,drpCountry_1.
 
Share this answer
 
Hi,

Refer below link to achieve your goal.
Dynamic Controls Made Easy in ASP.Net[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900