Ticket Q373555
Visible to All Users

Custom PropertyEditor based on ASPxListBox loses values

created 12 years ago

I've been trying to make ASPxListBox work which would function correctly with the confirmation rules mechanism from the ticket:
http://www.devexpress.com/Support/Center/Question/Details/Q473947

Could you please see the WebCheckedListBoxEnumPropertyEditor (my target functionality) and/or FromString_ListBoxPropertyEditor (a little simplified one) in my updated project?
Both of them get cleared whenever you empty the 'Opis' field and click Save.

I found such information: http://www.devexpress.com/Support/Center/p/Q303458.aspx
Maybe it would solve the issue and be integrated in XAF somehow ?

I am sorry to ask you one more time for the similar issue.

Show previous comments (2)
Dennis Garavsky (DevExpress) 12 years ago

    Thanks for the sample. I will convert it to 12.2 and test as soon as I can.

    KK KK
    Krzysztof Krzyzsłof 12 years ago

      I really need this functionality. Could you please try to solve/workaround this issue?
      Thanks, Krzysztof

      Dennis Garavsky (DevExpress) 12 years ago

        Yes, I checked it, but I am still working on a solution, because working with custom editors usually requires more time than normally + the custom validation you implemented is quite complex as well. I hope to get back to you by the end of this day with my latest results.

        Answers approved by DevExpress Support

        created 12 years ago (modified 12 years ago)

        Hello,
        Modify your code as follows:

        C#
        private void listBox_SelectedIndexChanged(object source, EventArgs e) { if (Editor.SelectedItems.Count > 0) { EditValueChangedHandler(source, e); } }

        I should mention that this may be not the last problem with the custom validation solution you implemented and this custom editor.
        UPDATE:
        In fact, my previous solution was rather a workaround than a real solution (it does not work if the items are unchecked), because we could not find a good way to avoid the situation when the listBox_SelectedIndexChanged method is triggered and indirectly calls the GetControlValueCore method.
        The problem is that this is all triggered by your custom confirmation script that causes a callback to the server and calls the ProcessAction (which commits data!) at the moment when this data is empty. I already discussed this issue with our ASP.NET team and it looks like there is no way to avoid the listBox_SelectedIndexChanged call when the post data is loaded. So, it looks like this particular scenario is not currently supported in XAF, unless you found a way to implement a custom selection cache (e.g., store selected values in the ASP.NET session) and maintain it valid between callbacks. Probably, using another confirmation method, e.g. a regular XAF popup View (e.g., use a solution from How to invoke a View without using Actions or from a place that is different from the Controller context or rather register a script that will show the ASPxPopupControl window directly) will help you avoid this problematic situation, but I have not tested it yet and I cannot guarantee that it will solve the problem - these are just my suggestions on what else you can try in this situation, because we do not have a proper solution at the moment.

          Show previous comments (5)
          Dennis Garavsky (DevExpress) 12 years ago

            Yes, you can try to display a View as shown in the How to invoke a View without using Actions or from a place that is different from the Controller context KB Article or use a custom cache, probably stored in the ASP.NET session.
            Alternatively, you can register a script that will show the ASPxPopupControl window directly. As I mentioned above, I cannot guarantee that it will solve the problem - these are just my suggestions on what else you can try in this situation, because we do not have a proper solution at the moment.

            KK KK
            Krzysztof Krzyzsłof 12 years ago

              Thank you - I will inform you about my results.
              We release a new app. version on Monday so I will need to temporarily use your simple workaround.
              Hopefully I will manage to fix it next week.
              Thanks once again and have a nice weekend, Dennis!

              Dennis Garavsky (DevExpress) 12 years ago

                Thanks for the feedback, Krzysztof. I have updated my original answer to mention the latest considerations.

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.