Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

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>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top