Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 09, 2012 07:25 AM by prakashmcas
Member
111 Points
109 Posts
Apr 04, 2012 10:26 AM|LINK
How can I add data to a databound combobox
Participant
1678 Points
492 Posts
Apr 04, 2012 10:27 AM|LINK
hi
Combo Box is in windows application,do you mean drop down list ?
342 Points
59 Posts
Apr 04, 2012 10:36 AM|LINK
To add static items to a databound dropdown list on a web page, you can add the AppendDataBoundItems="true" to your dropdown list. For instance, the example below will add the value "Please select a Value" to the databound dropdownl list <asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource1" DataTextField="state" DataValueField="state"> <asp:ListItem Text="Please select a Value" Value="" /> </asp:DropDownList>
Please "Mark as Answer" if this helped resolve your issue
290 Points
76 Posts
Apr 04, 2012 04:22 PM|LINK
If you want to add some dynamically as well and it is databound. Keep AppendDataBoundItems="true". Then in your code behind you can do this:
ListItem li = new ListItem("text", "value"); DropDownList1.Items.Add(li);
Apr 09, 2012 07:10 AM|LINK
yes I mean drop down list
42 Points
43 Posts
Apr 09, 2012 07:25 AM|LINK
ComboBox1.DataSource = dt ComboBox1.DisplayMember = "name" ComboBox1.ValueMember = "Id"
it may be help u......
ssa2010
Member
111 Points
109 Posts
Add data to a databound combobox
Apr 04, 2012 10:26 AM|LINK
How can I add data to a databound combobox
Sandeep Shen...
Participant
1678 Points
492 Posts
Re: Add data to a databound combobox
Apr 04, 2012 10:27 AM|LINK
hi
Combo Box is in windows application,do you mean drop down list ?
Skype : sandeep.d.shenoy
Gmail : sandeepdshenoy@gmail.com
bakra
Member
342 Points
59 Posts
Re: Add data to a databound combobox
Apr 04, 2012 10:36 AM|LINK
To add static items to a databound dropdown list on a web page, you can add the AppendDataBoundItems="true" to your dropdown list. For instance, the example below will add the value "Please select a Value" to the databound dropdownl list
<asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource1" DataTextField="state" DataValueField="state">
<asp:ListItem Text="Please select a Value" Value="" />
</asp:DropDownList>
Please "Mark as Answer" if this helped resolve your issue
trekie86
Member
290 Points
76 Posts
Re: Add data to a databound combobox
Apr 04, 2012 04:22 PM|LINK
If you want to add some dynamically as well and it is databound. Keep AppendDataBoundItems="true". Then in your code behind you can do this:
ListItem li = new ListItem("text", "value"); DropDownList1.Items.Add(li);ssa2010
Member
111 Points
109 Posts
Re: Add data to a databound combobox
Apr 09, 2012 07:10 AM|LINK
yes I mean drop down list
prakashmcas
Member
42 Points
43 Posts
Re: Add data to a databound combobox
Apr 09, 2012 07:25 AM|LINK
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "name"
ComboBox1.ValueMember = "Id"
it may be help u......