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.
Unfortunately, activation email could not send to your email. Please try again.

GridGroupingControl: Changing column value.

Thread ID:

Created:

Updated:

Platform:

Replies:

13903 May 13,2004 03:20 AM May 13,2004 08:13 AM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 13, 2004 03:20 AM

Hello. Since I cannot bind datasource such way: http://www.syncfusion.com/Support/forums/message.aspx?MessageID=13836 I should set parent_ID column of newly created row manually. Please tell me how can done it. The best solution for me is to set cell value when the editing of new row begins. May be there is necessary event "NewRowCreated" ?

Administrator [Syncfusion]
Replied On May 13, 2004 03:50 AM

You can also bind it with: DataSource = dataset1; DataMember = table1; And this will pick up the relation on table1, and auto populate the releated columns when you start editing a AddNew row in a child. Here is a little sample. nulls_1313.zip

Administrator [Syncfusion]
Replied On May 13, 2004 04:35 AM

But in my situation I should show child table, not parent: this.gridGroupingControl1.DataSource = ds; this.gridGroupingControl1.DataMember = childTable.TableName; And parentID will not be assigned automatically. :(

Administrator [Syncfusion]
Replied On May 13, 2004 08:12 AM

You can try handling the TableControlCurrentCellStartEditing event, and if it is teh AddNewRow, then set the value at this point.
private void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
{
	Element el = this.gridGroupingControl1.TableControl.Table.CurrentElement;
	if(el != null && el is GridAddNewRecord)
	{
		this.gridGroupingControl1.Table.AddNew();
		Record r = el as Record;
		int col = this.gridGroupingControl1.TableControl.CurrentCell.ColIndex;
		int field = this.gridGroupingControl1.TableDescriptor.ColIndexToField(col);
		int someParentID = 1;
		r.SetValue("ParentID", someParentID);
	}
}

Administrator [Syncfusion]
Replied On May 13, 2004 08:13 AM

You do not need the col and field lines in the above snippet.

CONFIRMATION

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.

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.

;