v
Not logged inv
SearchAsk a QuestionReport an IssueMake a SuggestionMy Questions and Issues
Issue Details
Find By ID

Enable/Disable Combo Boxs

Issue Details

Log in to Track Changes or Edit
Q91215
Question
Paul Ansloos
Yes
Processed
Answered
.NET
ASPxGridView and Editors Suite
7.3.3
Windows XP
Microsoft Visual Studio 2005
1/3/2008 4:11:02 PM
-> Created by Paul Ansloos 12/3/2007 3:42:09 PM

Is there an easy way to enable/disable combo boxes? I have a form with 5 combo boxes and a few textboxes. Everything is disabled except for one combo. When a selection is changed in that combo the program goes thru and enables the combo's that the user has access too. I can set the combos to enable="false" at design time but when i try to set enable to "True" at runtime in either serverside or client it does not work.
I found this example http://www.devexpress.com/Support/Center/SearchResults.aspx?searchtext=disable+combo&tid=4b2d6f97-c4ae-48fc-87f6-8c5da6541e40&pid=22713479-a995-45d4-9ed4-72ffa096d83d that disables the combo's and enables the way i want but it doesn't work 100%. I preload a few combo's on page load and i use the above example to disabled them. I also need to set this enableincrementalfiltering="true" which causes the problem. The above example will allow the user to still type in the combo box even though it is disabled. I have tried to set the readonly property to true and then change that at runtime but once again it does not work.

What can i do?

Thanks.

<- Reviewed by DevExpress Team 12/3/2007 3:56:02 PM
<- Processed (Answered) by DevExpress Team 12/3/2007 5:55:04 PM

Hi Paul,

Thank you for the report. Currently we do not provide a method to disable / enable ASPxEditors at the client side. So, we can only help you by creating a custom solution. Please describe your situation in as many details as you can and we will do our best to help you.

Thanks,
Plato

-> Reactivated by Paul Ansloos 12/3/2007 9:48:34 PM

Hi Plato,

When the form is loaded only one combo box should be enabled. All other combos and text fields will be disabled. When a selection is made in that one combo we then check to see what fields the user has access too and we enable the fields accordingly. I also need this enableincrementalfiltering="true" on every combo.
That is basically how this should work, not sure what else i can give you.

Thanks again

<- Processed (Answered) by DevExpress Team 12/4/2007 3:44:13 PM

Attachment: dxSample.zip (3844 bytes)

Hi,

Thank you for the report. I have created a sample project, which seems to work as you need. Please run it on your machine and let us know your results.

Thanks,
Plato

-> Reactivated by Paul Ansloos 12/4/2007 10:02:50 PM

HI Plato,

This works great! Thanks again for all your help

<- Processed (Customer Closed) by Paul Ansloos 12/4/2007 10:03:06 PM
-> Reactivated by Paul Ansloos 12/28/2007 9:34:13 PM

Hi,

Upon further testing with this it seems there is a bit of a glitch with it. When your sample loads everything is disable but the one combo. When a selection is made in that combo it then enables the other items. I changed one item in your code, this is the code is for the combo that is enabled in the begining. In the selectionchanged event the s.GetValue() were all equal to 1. I changed one of them to zero so that it will have the opposite effect from the other items. As shown below:
        <dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" ClientInstanceName="combo"
            SelectedIndex="0">
            <Items>
                <dxe:ListEditItem Text="0" Value="0" />
                <dxe:ListEditItem Text="1" Value="1" />
            </Items>
            <ClientSideEvents SelectedIndexChanged="function(s, e) {
     SetEditorIsEnabled(ASPxComboBox2, s.GetValue() == 1);
     SetEditorIsEnabled(ASPxTextBox1, s.GetValue() == 1);
     SetEditorIsEnabled(ASPxComboBox3, s.GetValue() == 0);
}" />
        </dxe:ASPxComboBox>

Now when i run this and i make a change in the enabled combo 2 out of 3 fields should be enable and the other still disabled. So top combo and textox should become enabled and 2nd combo should stay disabled. This is not the case though. When i first load and make a selction change all items become enabled. Then if i make another change top 2 fields become disable and 3rd item is enabled. If i make another selection change then top 2 items become enabled and third is disable, which is the way things should have worked in the beginning. So the first time things are changed this code fails.

Is there an easier way of going about this? Seems like a lot of code just to make a combo disable in script. Why can't setting webcombo.isDisabled to false, work?

Thank you

<- Processed (Answered) by DevExpress Team 1/3/2008 3:02:58 PM

Hi Paul,

We have not implemented client side method to disable our editors yet :(. We have a suggestion:

ASPxEdit - Support the Enable property on the client side

I suggest that you track it, in this case, you will be notified when its status is changed. Also, to resolve the problem you have found, change the code as shown below:

[JScript]

function ProcessActiveElements(container, removeAction) {
        if (container.onmousedown || container.savedOnMouseDown) {
            if(removeAction && container.onmousedown) {
                container.savedOnMouseDown = container.onmousedown;
                container.onmousedown = "";
            } else if (container.savedOnMouseDown && !removeAction) { // <<<<<
                container.onmousedown = container.savedOnMouseDown;
                container.savedOnMouseDown = null;
            }
        }
        for (var i = 0; i < container.childNodes.length; i++)
            ProcessActiveElements(container.childNodes[i], removeAction);
    }

Thanks,
Plato

-> Reactivated by Paul Ansloos 1/3/2008 3:32:26 PM

That fixed the problem.

Thanks Again...

<- Processed (Answered) by DevExpress Team 1/3/2008 4:11:02 PM

You are always welcome :)

Thanks,
Plato

P.S. The Support Center now allows you to close issues like this yourself if you wish. Just click the "Close Report" button.

Log in to Track Changes or Edit

Peer-to-Peer Discussion in DevExpress Forums

No discussion on this article has been started yet.

Please login to start discussion.

v
v
Search
Searching Tips