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 key to new row in datagrid

Thread ID:





40493 Feb 3,2006 06:06 PM UTC Feb 6,2006 04:13 AM UTC WinForms 1
Tags: GridControl
Asked On February 3, 2006 06:06 PM UTC

I have a data grid bound to a typed dataset with a primary key. How do I set a value for the key after adding a new row.

Administrator [Syncfusion]
Replied On February 6, 2006 04:13 AM UTC

Hi Kingsley, You can use the RowEditing event for selecting the Primary key. In the event, check for the last row index and add the primary key respectively. Here is the code snippet. private void gridDataBoundGrid1_RowEditing(object sender, Syncfusion.Windows.Forms.Grid.GridRowEventArgs e) { if(this.gridDataBoundGrid1.Model.RowCount == e.RowIndex) { this.gridDataBoundGrid1[e.RowIndex,1].CellValue = e.RowIndex; } } Refer this sample for details. Let us know if you need further assistance, Regards, Madhan.


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