Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 39166 |  Welcome, Guest!   Register  Login
 Home > Forums > C# > bind data to html dropdownlist ...
Venkatesh

bind data to html dropdownlist

Replies: 3 | Posted by: Venkatesh on 11/23/2010 | Category: C# Forums | Views: 3724 | Status: [Member] | Points: 10  


Hi,

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

How to do this.


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Lalji_mer
Lalji_mer  
Posted on: 11/23/2010 12:40:55 AM
Level: Bronze | Status: [Member] | Points: 25

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

T.saravanan
T.saravanan  
Posted on: 11/23/2010 12:51:11 AM
Level: Silver | Status: [Member] [MVP] | 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. | Reply | Alert Moderator 

Venkatesh
Venkatesh  
Posted on: 11/23/2010 12:59:54 AM
Level: Starter | Status: [Member] | 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. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/20/2013 6:16:57 AM