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

EmptyMessage without AllowCustomText?

4 Answers 64 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mike Bridge
Top achievements
Rank 1
Mike Bridge asked on 17 Nov 2008, 05:50 PM
Hi-

I am upgrading to RadControls AJAX from the non-AJAX version, and I find I can't display a non-selectable invitation (e.g. "Select from the following) any more for the RadComboBox.  In the previous version, I did this:

RadComboBoxItem editItem = new RadComboBoxItem("Select a Country...", "" ) {Visible = falseEnabled = false}; 

However, in the current version this doesn't work, and I see that using an "EmptyMessage" requires that I have "AllowCustomText" set to true, which I don't want in this case.

The reason I want it is because it is a control which does an autopostback---if I have one of the items preselected in it, it won't post back.

Thanks!

-Mike

4 Answers, 1 is accepted

Sort by
0
Mike Bridge
Top achievements
Rank 1
answered on 17 Nov 2008, 06:16 PM
After fooling around with it a bit, I think this does what I want:

RadComboBoxItem editItem = new RadComboBoxItem("Select a Country...", "" ) { 
   Selected = true,  
   Visible = false,  
   Enabled = false 
}; 

This makes the "Select a Country..." item appear in the Text area, but not in the drop-down menu.

But this seems to be undocumented behaviour---I'm not sure if it's a particularly good idea to do this.

-Mike
0
Veselin Vasilev
Telerik team
answered on 20 Nov 2008, 04:06 PM
Hi Mike Bridge,

This is a good workaround I think. You can use it.

Best wishes,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike Bridge
Top achievements
Rank 1
answered on 27 Nov 2008, 08:30 PM
Hi-

I found a problematic side effect with this workaround.  I have the RadComboBox inside a DataGrid, and the "Enabled=false" attribute somehow changes it so that any click event that occurs in the entire DataGrid row will then call the callback I've set in the RadComboBox's OnSelectedIndexChanged attribute.  For example, if I click on a LinkButton in the same row, it will still call the RadComboBox's OnSelectIndexChanged callback.

Since my workaround is kind of an undocumented hack, I think it's probably better to use a regular DropDownBox for this purpose.

Thanks,

-Mike
0
Simon
Telerik team
answered on 28 Nov 2008, 02:08 PM
Hello Mike Bridge,

We verified this issue in the support ticket you have opened and will investigate it further.

Please feel free to reopen the support ticket after a week and ask whether the issue has been resolved.

Thank you in advance for your understanding.

All the best,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Mike Bridge
Top achievements
Rank 1
Answers by
Mike Bridge
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Simon
Telerik team
Share this question
or