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

Set defualt drop down values in Edit form

1 Answer 33 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Manmeet asked on 09 Aug 2010, 05:24 AM

i am new to telerik controls but enjoying working on these controls.

during the development i stuck at a point, where i need to set default dropdown values in edit form. Here is the sample code
<label for='<%= PriorityDropDown.ClientID %>'>
        Leaving a newline here will affect the layout, so we use a comment instead.
    <telerik:RadComboBox runat="server" ID="PriorityDropDown" Skin='<%# Owner.Skin %>' Width="100px" AutoPostBack="true">
                    <telerik:RadComboBoxItem Text="Low" Value="Low" Selected='<%# Convert.ToBoolean((Convert.ToString(Eval("Priority")) == "Low")) %> ' />
                    <telerik:RadComboBoxItem Text="Medium" Value="Medium" Selected='<%# Convert.ToBoolean((Convert.ToString(Eval("Priority")) == "Medium")) %> ' />
                    <telerik:RadComboBoxItem Text="High" Value="High" Selected='<%# Convert.ToBoolean((Convert.ToString(Eval("Priority")) == "High")) %> ' />

I have added Priority attribute in custom names collection like : CustomAttributeNames="Priority"
Whenever i write 
<%(Convert.ToString(Eval("Priority")) == "Low") %>

it gives me "True" string but when i convert it to Boolean value It always give me false. please help me to sort out this problem.

Manmeet Singh

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 10 Aug 2010, 01:51 PM
Hi Manmeet,

You need to store and read the selected value in a custom attribute as in this kb article:

Kind regards,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question