DevExpress ASPxComboBox ClientEnabled Miff

Disabled means scrollable is allowed? Yesterday, the testing team discovered interesting behavior with a ASPxComboBox. A state combo box is disabled but still allowing mouse scrolling through the list of states. This is undesired behavior, confusing to users, and simply the wrong implementation or hmm … maybe a bug. Besides the performance issues with IE 7 which is not entirely DevExpress’s fault, more the fact IE 7 sucks I have been happy with DevExpress ASP.NET control suite. Can’t blame DevExpress for not tuning their suite for a five year old browser. Especially with IE 9 mainstream and IE 10 on the horizon. Who uses IE anyway? Chrome or FireFox not becoming the standard? I digress.

Like any large control suite, a few implementation and bug miffs reared their face. The expectations is an ASPxComboBox where ClientEnabled = false will NOT allow user to scroll the combo box data using mouse scroll. BUT … it does! If this is intended behavior, I do not agree. Here is an example:

The text and drop down arrow on the far right of the ASPxComboBox appear disabled to the user. However, place the cursor in the text box, scroll with the mouse wheel and the state values begin to change. In this case, the state color text is changed to blue. Once the focus has left the state selection remains and again appears to be disabled to the user.

To disable an ASPxComboBox on the client side, set the ClientEnabled property to false. The definition is below.

1
2
3
4
5
6
7
8
9
10
11
12
<cc_dxe:ASPxComboBox  ID="cmbCountry" runat="server"
                      ClientInstanceName="cmbCountry"
                      IncrementalFilteringMode="StartsWith"
                      Width="300px">
</cc_dxe:ASPxComboBox>

<cc_dxe:ASPxComboBox   ID="cmbState" runat="server"
                      ClientInstanceName="cmbState"
                      IncrementalFilteringMode="StartsWith"
                      ClientEnabled="false"
                      Width="300px">
</cc_dxe:ASPxComboBox>

To simply disabled the cmbState set the ClientEnabled property on the client side or server side. Server Side

1
cmbState.ClientEnabled = false;

ClientSide

1
cmbState.SetEnabled(false);

The desired flow is simple, enable the cmbState when a cmbCountry of code USA is selected otherwise disable cmbState. The term disable in this context means allow NO interaction from a user with the control ( i.e. no selection, scrolling, click event, etc. ). As described above the ClientEnabled = false is not satisfying this disable definition. Reviewing the ASPxComboBox properties lead to discovering a scrollable mouse property, AllowMouseWheel. Setting this property based on the value of ClientEnabled completely disabled the control, satisfying our definition.

Solution

1
2
cmbState.ClientEnabled = ( string.IsNullOrEmpty(pxSubject.CountryCd) || pxSubject.CountryCd.Equals("USA") );
cmbState.AllowMouseWheel = cmbState.ClientEnabled;

Comments