Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • All of our data has spaces at the end of every value. Is there a way to Trim all values before editing in a datagrid?

                                0

                                Hi,

                                 Handle the GridView.ShownEditor event, obtain the GridView.ActiveEDitro value, and finally set its value to a trimmed value:

                                [C#]
                                using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraEditors; private void gridView1_ShownEditor(object sender, EventArgs e) { GridView view = sender as GridView; if(view.ActiveEditor is TextEdit) ((TextEdit)view.ActiveEditor).Text = ((TextEdit)view.ActiveEditor).Text.Trim(); }

                                Thanks,
                                Plato

                                0

                                This is primarily what we needed thank you. One last question. Is there a way to Trim the value on display? The reason I ask is because the grid is displaying "..." in the cells with whitespace.

                                -Ryan

                                0

                                Never mind I think i got it.

                                Private Sub AdvBandedGridView1_CustomDrawCell(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs) Handles AdvBandedGridView1.CustomDrawCell
                                            If TypeOf e.CellValue Is String Then
                                                e.DisplayText = Trim(e.DisplayText)
                                            End If
                                End Sub

                                0

                                Hi,

                                I am happy to hear that the problem is resolved now. Thank you for letting us know of your progress.

                                Please feel free to contact us in case of any difficulties. We are happy to help you at any time.

                                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.

                                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