i have a dropdown which fill on page load event.
private void FillSponsor()
{
ddlSponsor.DataSource = Db.VCT_SPONSORs.Where(x => x.IS_ACTIVE.GetValueOrDefault() && x.IS_APPROVED.GetValueOrDefault());
ddlSponsor.DataBind();
}
Now what i want is to bind other dropdown with the first value of above dropdown. my second dropdown is:
protected void ddlSponsor_SelectedIndexChanged(object sender, EventArgs e)
{
ddlDivision.DataSource = Db.VCT_SPONSOR_DIVISIONs.Where(x => x.SPONSOR_ID==SponsorID);
ddlDivision.DataBind();
ddlDivision.Items.Insert(0, new ListItem("All", "0"));
}
My problem is how to call ddlSponsor_SelectedIndexChanged event from the FillSponsor method. My both dropdowns are in update panels.
Do you mean how would you call the method?
ddlSponsor_SelectedIndexChanged(this, EventArgs.Empty);
You can use DateBound Event instead. like...
protected void ddlSponsor_DataBound(object sender, EventArgs e)
{
ddlDivision.DataSource = Db.VCT_SPONSOR_DIVISIONs.Where(x => x.SPONSOR_ID==SponsorID);
ddlDivision.DataBind();
ddlDivision.Items.Insert(0, new ListItem("All", "0"));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With