Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • To help the user know which data he has modified and which is unchanged since the last save, I am using RowCellStyle to change the background color of changed cells.

                                    However, I cannot figure out how to do this immediately upon a cell change, for example, checking a checkbox. Apparently, RowCellStyle is only called after the user clicks in another row. Nothing I've tried in CellValueChanging activates the background styling.

                                0

                                Hello Terry,

                                I believe that the CB43883 (grid rowcellstyle) Support Center issue will be helpful in this situation. Please let me know whether the issue is resolved.

                                Thanks,
                                Anatol

                                0

                                Your sample does not solve my issue for two reasons:

                                1) I'm running in a near real-time environment. I don't want background threads running and waking up occasionally to see if the cells need to be restyled. I prefer them to be restyled when the user changes a cell value.

                                2) Every time LayoutChanged is called, it closes the current cell editor. I won't inflict that on my user. In your example, I cannot enter numbers with multiple digits without them getting wiped out.

                                So apparently, there is no way to restyle the grid cells while keeping a cell editor open and active? I'll have to teach my user to complete an entry and then click outside the cell to see the grid restyled.

                                0

                                Hello Terry,

                                Thank you for your feedback. Now I see that your situation differs from the one described in the CB43883 issue. The cause of the problem is that editors' values are not posted to the GridControl datasource immediately after being changed. I've created a sample project to demonstrate how to change this behavior. Please let me know whether this solution meets your requirements.

                                Thanks,
                                Anatol

                                dxSample.zip
                                0

                                Thank you. This is exactly what I want. Except for one thing: I can only enter negative numbers by first entering a number, then entering the minus sign. I can't enter in the normal way of typing the minus sign then the number.

                                0

                                Hello Terry,

                                To prevent this situation, use the following code

                                	
                                [C#]
                                if (gridView1.ActiveEditor.OldEditValue.Equals(gridView1.ActiveEditor.EditValue)) return;
                                Please let me know whether it is helpful.

                                Thanks,
                                Anatol

                                0

                                Where would this go? I don't quite understand what it's doing, but I tried it as the first line of code in ActiveEditor_EditValueChanged. That doesn't make any difference.

                                Though it didn't seem to make sense, I also tried it as the first line of code in bandedGridView1_ShownEditor and that excepted on a null reference in OldEditValue.

                                0

                                This works as the first code in ActiveEditor_EditValueChanged:

                                    if (bandedGridView1.ActiveEditor.OldEditValue.Equals("-") ||
                                        bandedGridView1.ActiveEditor.EditValue.Equals("-") ||
                                        bandedGridView1.ActiveEditor.OldEditValue.Equals("+") ||
                                        bandedGridView1.ActiveEditor.EditValue.Equals("+"))
                                    {
                                        return;
                                    }

                                Is that overkill?

                                0

                                Hello Terry,

                                Sorry for the misunderstanding. When you wrote that you are experiencing difficulties with entering negative numbers, I thought that you were using the SpinEdit editor for the numeric column. However, from your response, I see that you are using a simple TextEdit without a mask. In this case, your solution is acceptable (with some modifications), but from my point of view, it is better to use the following code:

                                	
                                [C#]
                                void ActiveEditor_EditValueChanged(object sender, EventArgs e) { TextEdit editor = gridView1.ActiveEditor as TextEdit; int selectionStart = 0, oldValue = 0, newValue = 0; if (editor != null) { if (gridView1.FocusedColumn.ColumnType == typeof(Int32)) { oldValue = (Int32)editor.OldEditValue; if (editor.EditValue is Int32) { newValue = (Int32)editor.EditValue; } else { if (!Int32.TryParse(editor.EditValue as String, out newValue)) { return; } } if (oldValue == newValue) return; } selectionStart = editor.SelectionStart; } gridView1.PostEditor(); gridView1.LayoutChanged(); gridView1.ShowEditor(); if (editor != null) { editor.SelectionStart = selectionStart; editor.SelectionLength = 0; } } public class DataSourceClass { ... private int _Value; public int Value { get { return _Value; } set { if (_Value != value) { _IsChanged = true; } _Value = value; } } }
                                However, I recommend that you apply the numeric mask for the numeric field. In this case, the user input will be restricted, and the EditValue will always be handled as the numeric type, so you won't have to care about the described situation. I've modified my sample to demonstrate this approach. For additional information, please refer to the Mask Type: Numeric help topics.

                                Thanks,
                                Anatol

                                dxSample.zip

                                To start a chat you should create a support ticket


                                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