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
close icon

GridListControl

When i use a GridListCOntrol as a CellStyle, in the primary DataTable it load the ValueMember; How can i assign not only the ValueMember, but some other fields to the primary DataTable?

1 Reply

AD Administrator Syncfusion Team June 6, 2003 07:48 AM UTC

> When i use a GridListCOntrol as a CellStyle, in the primary DataTable it load the ValueMember; How can i assign not only the ValueMember, but some other fields to the primary DataTable? > If I understand what you want, I think you would have to work with the actual two tables involved. The two tables wound be the datasource for the gridlistcontrol cell (say listTable) and the datasource for the griddataboundgrid (say gridTable). You would grab the values from the listTable, and set then directly into the datarow in the gridTable. To grab the values from the listTable, you can use the CurrentCellClosedDropDown event. Here is code that works in the CellTypes sample we shipped that uses the USStates object in an array list. For a datatable datasource, you would cast the object to a DataRowView.
private void grid_CurrentCellClosedDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
	if(cr != null)
	{
		USState state = (USState)cr.ListControlPart.SelectedItem;
		Console.WriteLine(state.LongName);
	}
}
Once you have the values (from the DataRowView.Row member), you would then put them directly into the gridTable by the Current datarowview in this table through its CurrencyManager.
CurrencyManager cm = (CurrencyManager)this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
DataRowView drv = (DataRowView)	cm.Current;
DataRow dr = drv.Row;
//set the values into dr

Loader.
Live Chat Icon For mobile
Up arrow icon