Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • How do I make a new row that is added to the GridView appear as the last row?

                                • Alexey Z (DevExpress Support) 09.13.2013

                                  Hello,

                                  As far as I understand, you wish to change a NewItemRow position. If so, set the GridView.OptionsView.NewItemRowPositionproperty to Bottom.
                                  If it does not help you, would you please clarify your task in greater detail?

                                • Developer9000 09.16.2013

                                  Thanks Alexey.
                                  To be more clear, if the GridView.OptionsView.NewItemRowPosition property is set to top, then a "row holder" appears in the topmost row. I use the gridview to view information. When information is added to the gridview, I want it to appear in the topmsot row. I do not want to have a placeholder or empty row anywhere. When I add information, or a new row of data to the gridview, how do i make it appear in the first row. (or the last row for that matter.

                                You must  log in  or  register  to leave comments

                                2 Solutions

                                Creation Date
                                Rating
                                Importance
                                Sort by
                                0

                                Hi, Are you finding it?

                                Video Tutorials: https://www.youtube.com/watch?v=2139TgNMD6s

                                	
                                [VB.NET]
                                	
                                [VB]
                                Imports DevExpress.XtraGrid Public Class frmUserGroup Private dt As DataTable Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim dr As DataRow = dt.NewRow() dr(0) = "0" & GridView1.RowCount + 1 dr(1) = txtUseGroUniqueName.Text dr(2) = txtUseGroDisplayName.Text dr(3) = txtUseGroDescription.Text dr(4) = Convert.ToInt16(chkUseGroStatus.CheckState) dt.Rows.Add(dr) GridControl1.DataSource = dt Dim rp As New DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit() _ With {.ValueChecked = "1", .ValueUnchecked = "0", .ValueGrayed = ""} GridView1.Columns(4).ColumnEdit = rp End Sub Private Sub frmUserGroup_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load dt = New DataTable dt.Columns.Add("No") dt.Columns.Add("Unique") dt.Columns.Add("Display") dt.Columns.Add("Description") dt.Columns.Add("Status") GridControl1.DataSource = dt End Sub End Class
                                How to add new rows GridControl Devexpress.png
                                You must  log in  or  register  to leave comments
                                0

                                Hello,
                                If no sorting is applied, GridControl displays data as it is located in the underlying data source. When you add a new row, it is added to the last position and GridControl will display it as the bottommost row.
                                So, if you want to add a new row to the topmost position, use the data source methods. For example, for DataTable you can use the following code snippet:

                                	
                                [C#]
                                Random rand = new Random(); DataTable dt = gridControl1.DataSource as DataTable; DataRow newRow = dt.NewRow(); newRow["ID"] = rand.Next(0, 100); newRow["Info"] = "Info" + (gridView1.RowCount - 1).ToString(); dt.Rows.InsertAt(newRow, 0);
                                Please see the attached project for more information. I hope you find this information useful and am looking forward to your results once you try this solution.

                                dxExampleGrid.zip
                                You must  log in  or  register  to leave comments

                                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