Hello,
I used underline datasource to get the field data. Now it works OK for master/slave combobox on grigroupingcontrol.
Thanks for help.
Here is my code in the two events.
//change slave combobox list according master combobox value
private void gdBase_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
int ind=gdBase.Table.UnsortedRecords.IndexOf(this.gdBase.Table.CurrentRecord);
if (ind<0) return; //ind=-1 no record
DataRow dr = mGridDataSet.Tables[0].Rows[ind]; // underline datasource
//1. TABLE DICT_FIELD
if (mFormParam.TableName.ToUpper()=="DICT_FIELD")
{
string sName=gdBase.TableDescriptor.Columns[cc.ColIndex-1].Name.ToUpper();
if (sName=="LOOKUP_FIELD_CODE" || sName=="LOOKUP_FIELD_VAL" || sName=="LOOKUP_FLTR_FIELD" )
{
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if(cr != null)
{
//cc.ConfirmChanges(false);
string sWhere = string.Format("TABLE_NAME = ''{0}''", dr["lookup_table"].ToString());
DataSet dsFldList=BL.Access.LoadDataSet("DICT_FIELD","FIELD_NAME",sWhere);
cr.ListBoxPart.DataSource=dsFldList.Tables["DICT_FIELD"];
cr.ListBoxPart.DisplayMember ="FIELD_NAME";
cr.ListBoxPart.ValueMember ="FIELD_NAME";
}
}
return;
}
}
// empty salve combobox when master combobox changed
private void gdBase_TableControlCurrentCellChanged(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
int ind=gdBase.Table.UnsortedRecords.IndexOf(this.gdBase.Table.CurrentRecord);
if (ind<0) return; //ind=-1 no record
DataRow dr = mGridDataSet.Tables[0].Rows[ind]; // underline datasource
//1. TABLE DICT_FIELD - master/slave combobox
if (mFormParam.TableName.ToUpper()=="DICT_FIELD")
{
if (gdBase.TableDescriptor.Columns[cc.ColIndex-1].Name.ToUpper()=="LOOKUP_TABLE" )
{
cc.ConfirmChanges(false);
dr["LOOKUP_FIELD_CODE"]= "";
dr["LOOKUP_FIELD_VAL"]= "";
dr["LOOKUP_FLTR_FIELD"]= "";
dr["LOOKUP_FLTR_VAL"]= "";
}
return;
}
}
>Try code like this:
>
>private void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
>{
> GridCurrentCell cc = e.TableControl.CurrentCell;
> GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex];
> GridRecord rec = style.TableCellIdentity.DisplayElement as GridRecord;
> if(rec != null)
> {
> rec.SetValue("theColumnName") = "";
> }
>}
>