Click here to Skip to main content
15,748,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i hv database value 100 i want to add 100 no. in dropdown list any concept to enter the quantity in dropdown shortest idea
thatraja 24-Oct-13 7:06am    
Still not clear, rephrase the question
Vinodh.B 24-Oct-13 7:07am    
Question not clear . Be specific or provide an example .
Harshil_Raval 24-Oct-13 7:15am    
Hi, what is your requirement. Do you want to insert number in dropdown, then see below..
DropDownID.Items.Insert(0, new ListItem("100", "100"));

1 solution

string databaseValue = "100";
ddlTest.Items.Add(new ListItem
 Text = databaseValue,
 Value = databaseValue

Note : Here ddlTest is the ID of the dropdown list.
Share this answer
avil py86t78 24-Oct-13 13:25pm    
public bindDropdownvalues()
ddlname.datasource="Table value from sql"
ddlname.datatextfield="or from the datatable we can assign and take values"
CodeBlack 25-Oct-13 0:24am    
if you have only one value from database and if you bind your dropdown list again than pre binded value will be lost and new value will be added. so better I suggest to add new value into existing datasource.
avil py86t78 25-Oct-13 13:56pm    
u want to create a stored procedure and call the values and then u assign the values in to a datatable and doing the above we can easily bind any number of datas in to webpage from database

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