0

I Have been working on a problem for the last couple of days with a few DevExpress ASPxComboBoxes. When the page loads, there are 5 boxes. the first one has selectable values, and the rest should be "inactive". When the active box changes value, it should fire the next combobox, get it to load data and deactivate the previous box.

We are using a mix of JavaScript and Server Site ASP.NET. The problem we are having are:

  • when we mark a control as Client Disabled (from server side), we cant get data out of it from the server side...
  • when we mark the control as Disabled (from server side) we cant get data out of it from either side...
  • when we mark the control as Disabled using Java Script, we get the same problem as Client Disabled from Server Side...
  • when we mark the control as ReadOnly, we cant "un-Readonly" it from client side!

we want to be able to mark child controls as inactive (readonly or disabled) and then re-activate them as we walk up the stack... we also need to be able to clear back down the stack (which is currently working in JavaScript, but the controls are still "active"). Any ideas?

TiernanO
  • 1,597
  • 14
  • 31

2 Answers2

1

You should use ClientEnabled property (server side) and SetEnabled method (client side). Don't use Enabled property because you can't enable editor with Enabled == false on client side.
As you wrote, you have a problem with this solution also. It's hard to be sure without source but you should check solution with ClientEnabled in different browsers.
If it works in IE and doesn't work in Chrome and FF, you probably have this problem:
ASPxComboBox lose value after a postback when the ClientEnabled property is false
ASPxTextBox ClientEnabled="false" loses value after postback
or even this:
ASPxTextBox value gets lost if ClientEnabled property is false

Filip
  • 3,257
  • 2
  • 22
  • 38
  • Hmmm.... thanks for the links. seems that could be our problem. we are using a mix of callbacks and postbacks, and any time the controls (both Text boxes and combo boxes) are marked as client disabled, we dont get anything back on the server side... And we test mostly in Chrome or Firefox... The suggestion on one of the links above is to enable the controls on the client side before the postback... Will look into that and see if it works... Thanks! – TiernanO Feb 02 '12 at 09:50
0

You can use the Client-side Events of AspxComboBox to do so.

For the First Comboboxes Init Event, Set Enabled = false for All other comboboxes, which makes them client disabled (on the client side). Within the Clientside SelectedIndexChanged method of each of the comboboxes, you can Enable any combobox as needed by your business logic. Rough Sample is as below:

 <dxe:ASPxComboBox ID="FirstCombobox" ...... >
      <ClientSideEvents Init="function(s, e){SecondComboBox.SetEnabled(false); ... FifthComboBox.SetEnabled(false);}" 
                        SelectedIndexChanged="function(s, e){SecondComboBox.SetEnabled(true); //or whatever your logic is}" >
    </dxe:ASPxComboBox>

    <dxe:ASPxComboBox ID="SecondComboBox" ClientInstanceName="SecondComboBox" ...... >
    </dxe:ASPxComboBox>
    ..
    ..
    ..
    <dxe:ASPxComboBox ID="FifthComboBox" ClientInstanceName="FifthComboBox" ...... >
    </dxe:ASPxComboBox>
Akhil
  • 7,570
  • 1
  • 24
  • 23
  • thanks for the info... but part of our problem is that when the control is marked as client disabled (SetEnabled(false)) we cant get the data out of it from the server side... – TiernanO Feb 01 '12 at 19:04
  • What kind of Data Are you talking About? if you are doing Callbacks using an AspxCallbackPanel, you can pass the required values (by using ClientSide Comobobox methods) from ClientSide as CallbackParameters. If you are doing otherwise, you can use an AspxHiddenField, which you can update on the client side as required, and use the HiddenField values on the server side. – Akhil Feb 01 '12 at 19:14
  • More info on "get data at server side" would help us know your exact problem. What kind of data? – Akhil Feb 01 '12 at 19:15
  • so, the data would be mainly IDs and text. Each combo box had a ID, and the load of the next combo box depends on that ID (children/parent style). the text from the combo box is also required... Looks like it could be a problem with the enable, as mentioned by @Filip... going to take the devexpress guy's advice from their site and try the client enable using JavaScript before postback... – TiernanO Feb 02 '12 at 09:53