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

Set an empty Text

1 Answer 89 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Leo
Top achievements
Rank 1
Leo asked on 23 Sep 2010, 01:33 PM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Sep 2010, 03:00 PM
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.
Tags
ComboBox
Asked by
Leo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or