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

GridDataBoundGrid behavior

I have a DataBoundGrid and a BoundColumn in the grid. I set the CellType of the column to MonthCalendar. I wish the CurrentCell to let me modify the data only from the MonthCalendar control (only when I push the button). I need these behavior because when I have a cell selected and I press any key on the keyboard the data cell changes and I get a error message: " ... is not a valid value for the DateTime", where "..." is the text in the cell. Thank you.

1 Reply

AD Administrator Syncfusion Team March 22, 2004 04:06 AM

One way you can prevent the cell from editing is to handle teh CurrentCellStartEditing event and set e.Cancel = true. I think you will also have to hand CurrentCellCloseDropdown and call CurrentCell.ConfirmChanges to make the selcted date show up in th ecell before you leave teh cell. Here are some snippets.
private void gridDataBoundGrid1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(this.gridDataBoundGrid1[cc.RowIndex, cc.ColIndex].CellType == "MonthCalendar")
		e.Cancel = true;
}
private void gridDataBoundGrid1_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
	if(e.PopupCloseType == Syncfusion.Windows.Forms.PopupCloseType.Done)
		this.gridDataBoundGrid1.CurrentCell.ConfirmChanges();
}

Loader.
Live Chat Icon For mobile
Up arrow icon