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

Custom new row behavior in GDBG

Dear Syncfusion team, I need the following behavior 1) "*" row is not showing (set via grid.EnableAddNew = false or some other way) 2) Grid is sortable 3) when user clicks "Add" button elsewhere on the form a new blank row is added at the last position and focus is transferred to first editable cell in that row. 4) row/columnchanging events do not fire until user actually changes data in the cells (i.e. new row is not committed to datasource before user changes any data) What would be the way to approach this? Thanks, Gene

1 Reply

AD Administrator Syncfusion Team November 13, 2003 11:11 PM UTC

You could leave EnableAddNew set to true, but just hide the new row until you need it.
//in formload, hide the addnew row
this.gridDataBoundGrid1.Model.HideRows[this.gridDataBoundGrid1.Model.RowCount] = true;

private void button1_Click(object sender, EventArgs e)
{
	this.gridDataBoundGrid1.Focus();
	this.gridDataBoundGrid1.Model.HideRows[this.gridDataBoundGrid1.Model.RowCount] = false;
	this.gridDataBoundGrid1.CurrentCell.MoveTo(
		this.gridDataBoundGrid1.Model.RowCount, 1, GridSetCurrentCellOptions.SetFocus);
}

private void gridDataBoundGrid1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
	this.gridDataBoundGrid1.Model.HideRows[this.gridDataBoundGrid1.Model.RowCount+1] = true;
}

Loader.
Live Chat Icon For mobile
Up arrow icon