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

Set initial text to blank

1 Answer 74 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Mattias asked on 01 Jul 2010, 02:23 PM
I'm using a radcombobox with checkboxes and need to set the initial text to blank.
I have tried different methods but nothing helps.
I have this code:
IList types = EnumHelper.ToLocalizedList(typeof(FaultyType), Resources.resources.ResourceManager); 
            foreach (KeyValuePair<Enum, string> keyval in types) 
                RadComboBoxItem item = new RadComboBoxItem(); 
                item.Text = keyval.Value; 
                item.Value = keyval.Key.ToString(); 

 <telerik:RadComboBox ID="radComboBoxFaultyTypes" runat="server"  
                            <div onclick="StopPropagation(event); SetFaultyTypesText();" class="combo-item-template"
                                <asp:CheckBox runat="server" ID="chk1" /> 
                                <asp:Label runat="server" ID="labelFaultyTypeName" AssociatedControlID="chk1" Text='<%# DataBinder.Eval(Container, "Text") %>' > </asp:Label> 

With this code the first elements text is set as initial text.
I want it to be blank or to be set like: "Please choose".
I could solve it be add a item with blank text and value but in that case I need to hide the checkbox in some way on that item.

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 01 Jul 2010, 03:14 PM
Hello Mattias,

Please look at the end of this help topic.

In your case you should check if the Container.DataItem is null in the Text property of the Label in ItemTemplate.

Let me know if you still have any questions.

Kind regards,
Veronica Milcheva
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