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

Minor issues in grouping grid foreign key reference

1. I have a foreign key reference (similar to the ForeignKeyReference example) where the displayed column is a name while the key column is a number. If I paste something to the displayed name column I get a format error. It seems that the pasted value go directly to the numeric key column instead of using the lookup mechanism. The behaviour of the control is fine when I type in the name instead of pasting. A similar behaviour is seen in the ForeingKeyReference example. In that case the pasted value is lost, but there is no error message. Is there a simple way to make pasting to foreign key columns work? 2. When I double click a foreign key column, the value changes. I think this is a bit confusising and can easily make the user change the value by accident, e.g. when trying to select. Is there a simple way to disable this behaviour?

2 Replies

AD Administrator Syncfusion Team April 22, 2005 12:52 PM UTC

1)I see this behavior and will forwarded it to the grid architect to see if this is something we can address in a future release. If you want to handle it now, one can subscribe to the this.gridGroupingControl1.TableModel.PasteCellText event. In the handler, check the string value in e.Text and convert it to a string holding the proper key. 2) Try handling the this.gridGroupingControl1.TableModel.QueryCellModel event. There you can set a property to avoid this behavior.
private void TableModel_QueryCellModel(object sender, GridQueryCellModelEventArgs e)
{
	if(e.CellType == "ForeignKeyCell")
	{
		GridTableDropDownListCellModel model = new GridTableDropDownListCellModel(e.GridModel);
		model.AllowDoubleClickChangeSelectedIndex = false;
		e.CellModel = model;
	}
}


AD Administrator Syncfusion Team April 24, 2005 09:10 AM UTC

1) For now I simply decided to prevent paste to foreign key cells. Since I typically sort on these cells, a proper handeling of paste would also need to adress the sorting issue I have mentioned in a previous post. 2) Works perfectly, Thanks.

Loader.
Live Chat Icon For mobile
Up arrow icon