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

How to deselect the items in a ComboBox

2 Answers 597 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Herman Gouw
Top achievements
Rank 2
Herman Gouw asked on 19 May 2010, 03:39 AM
Hi,

I am using RadControls for ASP.NET AJAX Q1 2010 SP1 in my current project.

Can you please tell me how to deselect the items in a ComboBox after it is initially loaded?

I tried to do it by setting SelectedIndex to -1 as follows but it didn't work.

protected void Page_Load(object sender, EventArgs e) 
    if (!IsPostBack) 
    { 
        this.rcbCategory.DataSource = PublisherServer.Categories(); 
        this.rcbCategory.DataTextField = "Name"
        this.rcbCategory.DataBind(); 
        this.rcbCategory.SelectedIndex = -1; 
    } 

Regards,
Herman Gouw


2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 May 2010, 12:01 PM
Hello,


Have you tried "ClearSelection()" method which clears out the list selection and sets the Selected property of all items to false.

Clear RadComboBox


Thanks,
Princy.

 

 

0
Kalina
Telerik team
answered on 20 May 2010, 06:40 PM
Hello Herman Gouw,

I suppose that your RadComboBox is read-only and in this case there will be always a selected item in it.

However you can add a “default” empty item to be displayed in the RadComboBox input.
In this way you will be able to "deselect" the initially selected item – you can find more details about this approach here.

If the issue persists, could you please explain your implementation in more details and send us a sample code? Thank you in advance.

Best wishes,
Kalina
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.
Tags
ComboBox
Asked by
Herman Gouw
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Kalina
Telerik team
Share this question
or