Set initial text to blank

2 posts, 0 answers
  1. Mattias
    Mattias avatar
    263 posts
    Member since:
    Aug 2012

    Posted 01 Jul 2010 Link to this post

    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.

  2. Veronica
    Veronica avatar
    1213 posts

    Posted 01 Jul 2010 Link to this post

    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
Back to Top