Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I have two boolean members set with the ImmediatePostData attribute. See code sample below.

                                    In the detail view for both Win and Web, it works as expected, the page reloads and properly adjusts the checkboxes so that only one is ever selected at one time. However, I have two problems:

                                    In the Win Forms application in an editable ListView, it requires two clicks to get the checkbox to check, AND I have to lose focus before the setter is fired. So this leaves both checkboxes checked onscreen until the focus is lost at which time the setters are fired.

                                    In the ASP.NET Web application in an editable ListView, both setters seem to fire in succession with their current values which causes this approach not to work at all.

                                    I would really like to use checkboxes like this to allow an item to be marked complete or incomplete, but how can I make them behave exclusive in the listviews?

                                    The BaseObject members

                                    /// <summary>
                                    /// True or False to indicate complete. Exclusive of Incomplete.
                                    /// </summary>
                                    [ImmediatePostData()]
                                    public bool Complete
                                    {
                                    get { return _Complete; }
                                    set
                                    {
                                    SetPropertyValue("Incomplete", ref _Incomplete, !value);
                                    SetPropertyValue("Complete", ref _Complete, value);
                                    }
                                    }

                                    /// <summary>
                                    /// True or False to indicate incomplete. Exclusive of complete.
                                    /// </summary>
                                    [ImmediatePostData()]
                                    public bool Incomplete
                                    {
                                    get { return _Incomplete; }
                                    set
                                    {
                                    SetPropertyValue("Complete", ref _Complete, !value);
                                    SetPropertyValue("Incomplete", ref _Incomplete, value);
                                    }
                                    }

                                • Hello Chad,

                                  Give us some time to research this problem. We will get back to you as soon as we can.

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hi Chad.

                                I am afraid I cannot reproduce the issue you described in an ASP.NET list view. However, I'd modify property declarations as follows:

                                [C#]
                                [ImmediatePostData()] public bool Complete { get { return _Complete; } set { bool old = Complete; if (old == value) return; _Complete = value; if (!IsLoading && !IsSaving) { OnChanged("Complete"); Incomplete = !Complete; } } } [ImmediatePostData()] public bool Incomplete { get { return _Incomplete; } set { bool old = Incomplete; if (old == value) return; _Incomplete = value; if (!IsLoading && !IsSaving) { OnChanged("Incomplete"); Complete = !Incomplete; } } }

                                As for WinForms list view, I recommend that you implement a solution suggested in the How to save the value of an in-place check box as soon as it is changed article.

                                If this does not help, provide us with a small sample project demonstrating the issues.

                                • Chad Michael 1 01.31.2013

                                  Well, your solution does seem to be an improvement on mine. Meaning, with your version, I can click around a few times and eventually, it starts working as I wanted. A problem I was experiencing though in both versions is that "sometimes" one or both of the checkboxes won't cause a postback to the server. I wasn't able to figure out what sequence causes this seemingly intermittent behaviour, but it only takes a few clicks to get it to happen on my system. I'm afraid I need to move on from this so I don't have time to build a sample project.

                                  So for now, I've disabled the ListView from being editable in the web version of my system. It works fine if they go into the detail view and mark the items there.

                                  Thank you for your suggestion on the WinForms listview. I also implemented http://www.devexpress.com/Support/Center/p/K18380.aspx in the same ViewController to allow for a single click check.

                                • Thank you for your reply. I am glad to hear that my assistance was (partially) helpful. I have tried to reproduce the ASP.NET list view issue locally as you described, but to no avail. Please let me know if I can help you further.

                                You must  log in  or  register  to leave comments

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners