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.

populate content of combobox according another combox picked value

Thread ID:

Created:

Updated:

Platform:

Replies:

29623 May 30,2005 03:56 PM May 31,2005 02:15 PM Windows Forms 5
loading
Tags: GridControl
Lan Mo
Asked On May 30, 2005 03:56 PM

Hello, On GridGroupingcontrol, I have two columns Table Name and Field Name, both are combobox dropdown list. I want to populate the content of field name combobox with the fields of table picked from table combobox. Any sample codes? lan

Administrator [Syncfusion]
Replied On May 30, 2005 04:18 PM

Try using the this.gridGroupingControl1.TableControlCurrentCellShowingDropDown event to set the second dropdown''s datasource. Here is a KB showing how to do this in a GridDataBoundGrid. The gridGroupingControl should be similar. http://www.syncfusion.com/Support/article.aspx?id=567

Lan Mo
Replied On May 31, 2005 11:47 AM

Hello, I try to replace the two events in GridGroupingControl. How I replace this line this.gridDataBoundGrid1[cc.RowIndex, SlaveColumn].Text = ""; besides, I want to use Column Name instead of ColumnIndex to identify master/slave columns because my form dynamicaaly load the field with user definied orders. Thanks, Lan >Try using the this.gridGroupingControl1.TableControlCurrentCellShowingDropDown event to set the second dropdown''s datasource. Here is a KB showing how to do this in a GridDataBoundGrid. The gridGroupingControl should be similar. >http://www.syncfusion.com/Support/article.aspx?id=567

Administrator [Syncfusion]
Replied On May 31, 2005 12:58 PM

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") = "";
	}
}

Lan Mo
Replied On May 31, 2005 01:10 PM

I tried. the object "rec" always null. >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") = "";
>	}
>}
>

Lan Mo
Replied On May 31, 2005 02:15 PM

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") = "";
>	}
>}
>

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.

;