RadComboBox - Property to display text when there isn't data to bind

2 posts, 0 answers
  1. ok
    ok avatar
    3 posts
    Member since:
    Oct 2010

    Posted 09 Nov 2010 Link to this post

    Hi,

    I am using telerik:RadComboBox in my application.
    I am biding data dynamically to the combobox so if there isn't any data to bind in the combobox and i am clicking on the combobox there is one dark link under the control is displayed.
    I don't want this.

    So, Is there any property available so i can display a string that "No Data" so user can view that instead of that dark unwanted line.
    If property is not available then kindly suggest any method to avoid this.

    Please reply asap.

    Thanks in advance.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Nov 2010 Link to this post

     Hello,

    One suggestion is setting EmptyMessage property to desired text in order to notify user that there is no items in RadComboBox. 

    C#:
    protected void RadComboBox1_DataBound(object sender, EventArgs e)
        {
                if (RadComboBox1.Items.Count == 0)
                RadComboBox1.EmptyMessage = "Nodata";
        }

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="186px" DataSourceID="SqlDataSource1"
                DataTextField="new" DataValueField="new" OnDataBound="RadComboBox1_DataBound"
                AllowCustomText="false" onitemdatabound="RadComboBox1_ItemDataBound">
    </telerik:RadComboBox>

    Thanks,
    Princy.
Back to Top