Aug 02, 2011, 8:15 PM
Linked combo boxes not showing data
Hi,
In my app I have four Combos that are linked.
- Selection of combo 1 fetches and displays data for combo 2.
- Selection of combo 2 fetches and displays data for combo 3...and so on.
I have checked the example - https://examples1.ext.net/#/Form/Com...ed_ComboBoxes/ but haven't fully followed it since I don't need to load combo data using any proxy. In my 1st combo, I set a DirectEvent on Select which is calling a handler and this call is running neatly. In that handler im taking 1st combo's selected value as param, fetching data and binding it for 2nd combo. I can see all these going nicely in debug mode but my 2nd combo is not displaying any data. Any idea? Im providing my code snippets below. Thanks in advance.
In my app I have four Combos that are linked.
- Selection of combo 1 fetches and displays data for combo 2.
- Selection of combo 2 fetches and displays data for combo 3...and so on.
I have checked the example - https://examples1.ext.net/#/Form/Com...ed_ComboBoxes/ but haven't fully followed it since I don't need to load combo data using any proxy. In my 1st combo, I set a DirectEvent on Select which is calling a handler and this call is running neatly. In that handler im taking 1st combo's selected value as param, fetching data and binding it for 2nd combo. I can see all these going nicely in debug mode but my 2nd combo is not displaying any data. Any idea? Im providing my code snippets below. Thanks in advance.
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
}
if (!IsPostBack)
{
if (ShowCountry)
{
BindCountryDDL();
}
}
}
protected void Country_Changed(object sender, DirectEventArgs e)
{
BindDivisionDDL(this.ddlCountry.SelectedItem.Value);
}
/// <summary>
/// Private method to load Division drop down
/// </summary>
private void BindDivisionDDL(string countryOID)
{
IList<Division> divisionList;
ddlDivision.Items.Clear();
if (!string.IsNullOrEmpty(countryOID))
{
divisionList = new DivisionManager(false).GetAllDivisionByCountry(countryOID);
}
else
{
divisionList = new DivisionManager(false).GetAllDivision();
}
foreach (Division division in divisionList)
{
string textField = string.Empty;
string valueField = string.Empty;
if (UtilityCommon.GetCurrentCulture().Equals(AMMSConstants.SITE_CULTURE_BN))
{
textField = division.DivisionName_BN;
}
else
{
textField = division.DivisionName;
}
valueField = division.OID;
ddlDivision.Items.Add(new ListItem(textField, valueField));
}
if (!string.IsNullOrEmpty(UtilityCommon.GetValueFromHttpQueryString(this.Request, AMMSConstants.QUERY_STRING_PARAM_DIVISION_OID)))
{
ddlDivision.SelectedItem.Value = UtilityCommon.GetValueFromHttpQueryString(this.Request, AMMSConstants.QUERY_STRING_PARAM_DIVISION_OID);
ddlDivision.Selectable = false;
}
else
{
ddlDivision.Selectable = true;
}
ddlDivision.DataBind();
}
</script>
<ext:Panel ID="pnlCommonSettingSearch" Icon="CameraMagnify" runat="server" AutoHeight="True" Floating="false" AnchorHorizontal="100%"
AutoWidth="True" Title="Search">
<Content>
<table style="width: 100%;">
<tr>
<td style="width: 50%;">
<ext:Store ID="storeParent" runat="server"/>
<ext:ComboBox
ID="ddlCountry" runat="server"
FieldLabel="Country "
Editable="false"
TypeAhead="true"
Mode="Local"
ForceSelection="true"
TriggerAction="All"
SelectOnFocus="true"
Width="250" Visible="false"
EmptyText="-- Select Country --">
<DirectEvents>
<Select onevent="Country_Changed"/>
</DirectEvents>
<%-- <Listeners>
<Select Handler="#{ddlDivision}.clearValue();#{CitiesStore}.load();" />
</Listeners>
--%>
</ext:ComboBox>
</td>
<td style="width: 50%;">
<ext:ComboBox ID="ddlDivision" runat="server"
Editable="false"
TypeAhead="true"
Mode="Local"
ForceSelection="true"
TriggerAction="All"
SelectOnFocus="true"
ValueNotFoundText="Loading..."
Width="250" Visible="false" EmptyText="-- Select Division --">
</ext:ComboBox>
</td>
</tr>
<tr>
<td style="width: 50%;">
<ext:ComboBox ID="ddlDistrict" runat="server" FieldLabel="District "
Editable="false"
TypeAhead="true"
Mode="Local"
ForceSelection="true"
TriggerAction="All"
SelectOnFocus="true"
ValueNotFoundText="Loading..."
Width="250" Visible="false" EmptyText="-- Select District --">
</ext:ComboBox>
</td>
<td style="width: 50%;">
<ext:ComboBox ID="ddlUpazilla" runat="server" FieldLabel="Upazilla "
Editable="false"
TypeAhead="true"
Mode="Local"
ForceSelection="true"
TriggerAction="All"
SelectOnFocus="true"
ValueNotFoundText="Loading..."
Width="250" Visible="false" EmptyText="-- Select Upazilla --">
</ext:ComboBox>
</td>
</tr>
<tr>
<td style="width: 50%;">
<ext:TextField ID="txtCode" runat="server" FieldLabel="Code " Width="250px" Visible="false" EmptyText="Enter Code.."/>
</td>
<td style="width: 50%;">
<ext:TextField ID="txtName" runat="server" FieldLabel="Name " Width="250px" Visible="false" EmptyText="Enter Name.."/>
</td>
</tr>
</table>
</Content>
</ext:Panel>