Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Forums Author
Sun, 31-Aug-2014 Authors
All Time Authors
Jayakumars
4160
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)
 Forum Post

bind data to html dropdownlist

Venkatesh
Posted by Venkatesh under C# on 11/23/2010 12:16:06 AM | Points: 10 | Views : 12630 | Status : [Member] | Replies : 3


Hi,

How to bind data to html dropdownlist control using c#. The data will be coming from database.

How to do this.



Posted by: Lalji_mer on: 11/23/2010 [Member] Bronze | Points: 25

Posted by: T.saravanan on: 11/23/2010 [Member] [MVP] Silver | Points: 25

Hi Venkatesh,

In your source page set in HTML Select control runat="server"
<select id="ddlDrop" runat="server> </select>


Your code behind:
Get the value into DataTable
Here dtData --> Your DataTable
ddlDrop.DataSource= dtData.Copy();

ddlDrop.DataValueField="ID";
ddlDrop.DataTextField="Name";
ddlDrop.DataBind();


Try this way...

Cheers :)

Thanks,
T.Saravanan

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

Posted by: Venkatesh on: 11/23/2010 [Member] Starter | Points: 25

Hi,

Thanks for replying. Now, i want add checkboxes in the same dropdown how to achieve this.

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

Login to post response


Found interesting? Add this to: