on 07-04-2017 2:32 PM
In my User Defined Form, I have two drop down(Combobox) list, "Deparments" and "Developers".
"Deparments" (combobox) that contain list of all departments in a company.
I have another field which is an input field called "Developers".
When a department name get selected change into a Departments drop-down, then bind all related Developers names into "Developers" comboBox,
Thank you.
Hi All,
Here is the working code for drop down onchange event , bind another dropdown related values.
public void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
try
{
if ((pVal.FormUID == "WID_MyFromID"))
{
if (((pVal.ItemUID == "ddl_Department") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) & (pVal.Before_Action == false)))
{
dropDownSelectChange();
}
}
}catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void dropDownSelectChange()
{
try
{
SetApplication();
SAPbouiCOM.ComboBox cb = null;
SAPbouiCOM.Item oItem = null;
SAPbouiCOM.Form oForm = SBO_Application.Forms.ActiveForm;
if (oForm.UniqueID == "FP_TaskTypeForm")
{
var DeptId= "";
string descrition = "";
SAPbouiCOM.ComboBox cbxDepartment = (SAPbouiCOM.ComboBox)oForm.Items.Item("ddl_Department").Specific;
if (cbxDepartment.Selected != null)
{
descrition = cbxDepartment.Selected.Description;
DeptId= cbxDepartment.Selected.Value;
}
try
{
oItem = oForm.Items.Item("ddl_Developers");
cb = ((SAPbouiCOM.ComboBox)(oItem.Specific));
int Count = cb.ValidValues.Count;
for (int i = 0; i < Count; i++)
{
cb.ValidValues.Remove(cb.ValidValues.Count - 1, SAPbouiCOM.BoSearchKey.psk_Index);
}
BindDevelopersListComboBox(cb, Convert.ToInt32(DeptId));
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void BindDevelopersListComboBox(SAPbouiCOM.ComboBox oCombo, int ID)
{
//Here drop down binding logic code only.
}
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
8 | |
6 | |
5 | |
5 | |
4 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.