Bind Combobox with a databae Column?
By Wizard i have bind a column of db to Combobox now i want to bind it by programming please guide me using c#
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Alok UniyalRank #8,369 · 223 reputationPosted Jan 27, 2013, 7:10 PM EST
ComboBox1.DataSource = dt;
ComboBox1.DisplayMember = "Name";
ComboBox1.ValueMember = "ID";
Where 'Name' and 'ID' are columns of Database Table
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 27, 2013, 9:11 PM EST
Agree with Alok
only one correction if you use ASP.net application
ComboBox1.DataSource = dt;
ComboBox1.DataValueField = "ID";
ComboBox1.DataTextField = "NAME";
ComboBox1.DataBind();
hope this will help you.