Test your technical skills online, appear in Virtual Interview and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Make friends on DotNetFunda.com and expand your network!
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Forums Author
Wed, 23-Apr-2014 Authors
Saranpselvam
20
Sheonarayan
10
Sivakumar.S
10
All Time Authors
Jayakumars
3930
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)

bind data to html dropdownlist

Venkatesh
Posted by Venkatesh under C# on 11/23/2010 12:16:06 AM | Points: 10 | Views : 7146 | 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.



Reply | Reply with Attachment

=> Scroll below for responses


Comments or Responses

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.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: