This is a migrated thread and some comments may be shown as answers.

[Solved] binding and selecting default value for combobox

2 Answers 185 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Teoman
Top achievements
Rank 1
Teoman asked on 28 Dec 2009, 07:56 PM
i binded a combobox with a sqldatasource and created a default selected value with combobox builder.I want to select default value for my combobox is "--all--".My code look like this but its not working.

<telerik:RadComboBox ID="market" Runat="server" Width="205px" DataSourceID="market_ds" DataTextField="Code" DataValueField="MainCodeID">  
<Items>   
<telerik:RadComboBoxItem runat="server" Text="-- all --" Value="all" Selected="true"/>   
</Items>   
</telerik:RadComboBox>   
 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 29 Dec 2009, 05:42 AM
Hello Teoman,

Set the AppendDataBoundItems property to True in order to achieve the functionality. Setting AppendDataBoundItems to True preserves the items that are already present in the combobox.

-Shinu.
0
Teoman
Top achievements
Rank 1
answered on 29 Dec 2009, 09:08 PM
its working thank you.
Tags
ComboBox
Asked by
Teoman
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Teoman
Top achievements
Rank 1
Share this question
or