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

adding a new row to a GGC

Thread ID:





39861 Jan 19,2006 05:50 PM UTC Jan 20,2006 01:23 AM UTC WinForms 6
Tags: GridControl
Eric Weber
Asked On January 19, 2006 05:50 PM UTC

Help! I''m using a GGC and have the grid populated with some rows. I also have the blank "add new row" row at the top (the row with the asterisk). My grid is bound to an IBindingList populated with IEditableObjects. My question is....How do I use the "add new row" row - the asterisk row? How do I validate the user''s entries, move the data down into the grid, etc. Are there any samples available for me to look at? Or similar posts? Or documentation? Thanks, eric

stanleyj [Syncfusion]
Replied On January 19, 2006 06:08 PM UTC

Hi Eric, The add new record row can be set on the top/bottom using the following code. this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = true; this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = true; On enter key the data in this row is moved to the grid, also when moving out of this row. To validate, you can try TableControlCurrentCellValidating setting TableCellType as AddNewRecordFieldCell and CurrentRecordContextChange handler. See if this helps Best regards, Stanley

Eric Weber
Replied On January 19, 2006 07:20 PM UTC

thanks Stanley! A couple more questions for you.... Each of my GGC rows is bound to an object. The object has 6 properties, but only 4 of these properties are visible grid columns, 2 columns/properties are hidden. Of the 4 visible columns, 2 columns are not editable (date/time and user), and 2 are editable. How can I get the 2 non-editable columns to display default values when the user begins typing in the editable fields. I want the date/time column to show the Now() value, and the user field to display a string value. Also, at what point do these 4 column values become an object? I just don''t want the 4 values to move down into the grid, I need to create a new object, add it to the array list, and populate the other 2 non-visible object properties. Thanks! Eric

Eric Weber
Replied On January 19, 2006 07:31 PM UTC

currently when i type something in the new row and then hit ENTER, the row gets moved to the grid, but when it shows up in the grid the entire row is blank.

Eric Weber
Replied On January 19, 2006 07:44 PM UTC

Nevermind the part about getting an object added to the array list. I figured that part out. The only thing I need to know now is how to set default values in the empty row. thanks for all of your help!

stanleyj [Syncfusion]
Replied On January 19, 2006 07:56 PM UTC

Hi Eric, See if the sample in this thread meets your need. Best regards, Stanley

Eric Weber
Replied On January 20, 2006 01:23 AM UTC

Yes, thank you, that helped. Actually though, I came across a snipet of code in these forums that you actually suggested which works much better.... private void CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e) { if(e.Action == CurrentRecordAction.BeginEditComplete && e.Record is GridAddNewRecord) { GridAddNewRecord rec = e.Record as GridAddNewRecord; rec.SetValue("Timestamp", System.DateTime.Now); rec.SetValue("User", "JOHN SMITH"); } }


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