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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

add value in new row

Thread ID:





11080 Feb 23,2004 02:09 PM UTC Feb 25,2004 12:53 PM UTC WinForms 7
Tags: GridControl
Asked On February 23, 2004 02:09 PM UTC

I have gridDataBoundGrid and property enableAddNew is true. I want fill some cellValue in last row when I enter in last row.

Administrator [Syncfusion]
Replied On February 23, 2004 02:24 PM UTC

Maybe the information in this forum thread will help you do what you want. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=5027

Replied On February 24, 2004 12:22 PM UTC

Thank you. It works fine. But I can''t cancel saving row in event RowSaved. When I set e.Cancel = true in event RowSaved, new row creates in grid when I press arrow keys next time in grid.

Administrator [Syncfusion]
Replied On February 24, 2004 12:41 PM UTC

RowSaved is too late. Try the RowLeave event, and if you want to not save teh changes, then have code similar to
private void gridDataBoundGrid1_RowLeave(object sender, GridRowEventArgs e)
	if(e.IsAddNew && dontWantToSave )

Replied On February 24, 2004 01:20 PM UTC

Event GridRowEventArgs haven''t property IsAddNew (e.IsAddNew).

Administrator [Syncfusion]
Replied On February 24, 2004 01:27 PM UTC

It does in the 2.0 code base. The code I listed was taken from a working sample. In earlier versions, you can test whether you are on the addnew row by checking something like if(e.RowIndex == this.gridDataBoundGrid1.Model.RowCount) { }

Replied On February 25, 2004 12:21 PM UTC

Thank you very much, I have another problem. I have grid with binding to dataset. This dataset has column named ID with NOT NULL constraint but this column isn''t in grid. When I create new row in grid and this row is saved, application displays message "Column ID does not allows nulls". I don''t know how can I fill this column in dataset. I tried to fill this column in event RowSaved but it was late. And before event RowSaved the row isn''t in dataset. I added this column in grid and set invisible and I filled in event RowLeave. It works fine but I''m looking for some simpler way.

Administrator [Syncfusion]
Replied On February 25, 2004 12:53 PM UTC

Can you set the DefaultValue property on the DataColumn? Then when DataTable.NewRow is called, this column should be populated with teh default value. myDatatable.Columns["ID"].DefaultValue = "something";


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon