I have a dropdown down after postback i want to bind the second dropdown . i get the value but that is not displayed in the second data:EntityDropDownList .
<ItemTemplate>
<data:EntityDropDownList runat="server" ID="dataServiceTypeId" Enabled="false" DataSourceID="ServiceTypeIdServiceTypesDataSource"
DataTextField="ServiceCode" DataValueField="ServiceTypeId" SelectedValue='<%# Bind("ServiceTypeID") %>'
AppendNullItem="true" Required="true" NullItemText="< Please Choose ...>" ErrorText="Required" />
<data:ServiceTypesDataSource ID="ServiceTypeIdServiceTypesDataSource" runat="server"
SelectMethod="GetAll" />
</ItemTemplate>
<EditItemTemplate>
<data:EntityDropDownList runat="server" ID="dataServiceTypeId" DataSourceID="ServiceTypeIdServiceTypesDataSource" OnSelectedIndexChanged="Service_SelectChange" AutoPostBack="true"
DataTextField="ServiceCode" DataValueField="ServiceTypeId" SelectedValue='<%# Bind("ServiceTypeID") %>'
AppendNullItem="true" Required="true" NullItemText="< Please Choose ...>" ErrorText="Required" />
<data:ServiceTypesDataSource ID="ServiceTypeIdServiceTypesDataSource" runat="server"
SelectMethod="GetAll" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Default">
<ItemTemplate>
<asp:CheckBox ID="chkDefault" Checked='<%# Bind("IsDefault") %>' Enabled="false" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="chkDefault" Checked='<%# Bind("IsDefault") %>' runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Plan">
<ItemTemplate>
<data:EntityDropDownList runat="server" ID="dataPricePlanId" Width="200px" />
</ItemTemplate>
<EditItemTemplate>
<data:EntityDropDownList runat="server" ID="dataPricePlanId" Width="200px" AppendNullItem="true" NullItemText="< Please Choose ...>" />
</EditItemTemplate>
</asp:TemplateField>
And my code is this
protected void Service_SelectChange(object sender, EventArgs e)
{
dataPricePlanId.Items.Clear();
string sValue = ((EntityDropDownList)sender).SelectedValue;
int ServiceTypeId = Convert.ToInt32(sValue);
TList<PricePlans> _pricePlans = _pricePlanService.GetByServiceTypeId(ServiceTypeId);
_pricePlanService.DeepLoad(_pricePlans);
if (_pricePlans.Count > 0)
{
dataPricePlanId.DataSource = _pricePlans;
dataPricePlanId.DataTextField = "Description";
dataPricePlanId.DataValueField = "PricePlanId";
dataPricePlanId.DataBind();
}
else
{
dataPricePlanId.Items.Insert(0, new ListItem("No Plan For this Service", "0"));
}
}
i get value but my grid is not binding in second dropdownlist. Can you please help me .