We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





45248 Jun 15,2006 09:16 AM UTC Jun 16,2006 09:22 AM UTC WinForms 4
Tags: GridControl
Omry Levy
Asked On June 15, 2006 09:16 AM UTC

Hi there, I am new to the data grid control and i used the edit option of the grid in edit mode through the IDE designer to add my column and headers. When i press add row (or by code) the header moves one line down and the new line is at index 0 of the grid. How can i get the normal behaviour , the header line doesn''t move and the new line is appended at the bottom ?

Administrator [Syncfusion]
Replied On June 15, 2006 09:33 AM UTC

Hi OL, Try this code to add a row at the bottom of the last row in a grid. Here is a code snippet. this.gridControl1.RowCount = this.gridControl1.RowCount + 1 ; this.gridControl1.Data.RowCount = this.gridControl1.Data.RowCount + 1; Let me know if this helps. Best Regards, Haneef

Omry Levy
Replied On June 15, 2006 12:31 PM UTC

Yes it worked Thanks But why is the default behaviour opposed to natural grid behaviour when adding a new row the header should stay at the top and the rows should append. Is there a style in the grid to achive this ? How can i change the cells content of the new row ?

Omry Levy
Replied On June 15, 2006 01:37 PM UTC

How do i change the new row cells content by code , i know that they can have default values from the designer but i want to set them by code ? Thanks, 0L

Administrator [Syncfusion]
Replied On June 16, 2006 09:22 AM UTC

Hi OL, You need to use the EndUpdateRequest event to sets the default values to the newly inserted row in a grid. Please refer to the sample for more details. bool IsPopulateValues = true; private void gridControl1_EndUpdateRequest(object sender, Syncfusion.Windows.Forms.Grid.GridEndUpdateRequestEventArgs e) { int NewRowCount = this.gridControl1.RowCount; if(IsPopulateValues && OldRowCount != -1 && OldRowCount != NewRowCount ) { IsPopulateValues = false; OldRowCount = NewRowCount; this.gridControl1.PopulateValues(GridRangeInfo.Cells(NewRowCount,1,NewRowCount, this.gridControl1.ColCount ) ,dt); this.gridControl1.RefreshRange( GridRangeInfo.Row(NewRowCount )); IsPopulateValues = true; } } You can add the rows to the anyposition of grid by using the Rows.InsertRange() method. this.gridControl1.Rows.InsertRange(5,1 ); // this code inserts a single row at the fifth position Here is a sample. http://www.syncfusion.com/Support/user/uploads/AddNewRowGC_4e9ee127.zip Let me know if this helps. Best Regards, Haneef


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon