Set an empty Text

2 posts, 0 answers
  1. Leo
    Leo avatar
    20 posts
    Member since:
    Jul 2010

    Posted 23 Sep 2010 Link to this post

    Hi,

    How can I set an Empty Text when the RadCombo is loaded?

    In the attached code, after the binding, The item "Mark" is automatically highlighted (but not selected, as I want).
    My goal is to have, after the binding, no selected elements and an empty Text in the combobox.
    The dropdown has to stay "read-only" (user cannot input text)

    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server">
    </telerik:RadScriptManager>
    <telerik:RadComboBox DataValueField="ID" EnableTextSelection="false"
        Skin="Default" DataTextField="Name" ID="RadComboBox1" runat="server" >
    <ItemTemplate>
        <asp:CheckBox runat="server" ID="chk1"/>
        <asp:Label runat="server" ID="Label1" AssociatedControlID="chk1" Text='<%# Eval("Name") %>'></asp:Label>
    </ItemTemplate>
    </telerik:RadComboBox>
     
     
    </form>
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Configuration;
    using System.Web.Security;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Telerik.Web.UI;
    using System.Web.UI.MobileControls;
    using RadControlsWebApp1;
    using System.Collections.Generic;
     
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<Item> items = new List<Item>();
            items.Add(new Item() { Id = 1, Name = "Mark" });
            items.Add(new Item() { Id = 2, Name = "Jon" });
            items.Add(new Item() { Id = 3, Name = "Frank" });
     
            //RadGrid1.DataSource = items;
            if (!IsPostBack)
            {
                RadComboBox1.DataSource = items;
                RadComboBox1.DataBind();
            }
        }
     
    }


    How can I achieve this?

    thanks.

    Leo

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Sep 2010 Link to this post

    Hello Leo,

    Try the approach described in following forum to show EmptyMessage and pervent user to type in textbox.
    RadComboBox EmptyMessage and AllowCustomText property


    -Shinu.
Back to Top