Hello, I have a web user control with 2 combo boxes, and 2 LLBLGenProDataSource2 controls. Both datasource controls have their LivePersistence mode == false.
Basically, the first combo box is a list of countries. The second is a list of states. You load the countries and bind the combo. The user clicks a contry and the states combo should be re-bound.
Pretty straight forward. I cannot seem to get the StateDataSource_PerformSelect to fire again. The datasource select methods once a peice, but that seems to be it. Am I approaching this the wrong way?
Here is all the code that exists in my web user control:
protected void CountryDataSource_PerformSelect(object sender, PerformSelectEventArgs2 e)
{
LoadCountries(e);
}
protected void StateDataSource_PerformSelect(object sender, PerformSelectEventArgs2 e)
{
LoadStates(e);
}
protected void CountryCombo_SelectedIndexChanged(object sender, EventArgs e)
{
// why wont the StatesDataSource do the select again?
StateDataSource.Select();
StateDataSource.DataBind();
}
private void LoadCountries(PerformSelectEventArgs2 e)
{
EntityCollectionNonGeneric countryData = (EntityCollectionNonGeneric)e.ContainedCollection;
MyCountryRegionEntity.FetchAllCountries(ref countryData);
}
private void LoadStates(PerformSelectEventArgs2 e)
{
if (CountryCombo.SelectedItem != null &&
string.IsNullOrEmpty(CountryCombo.SelectedValue) == false)
{
EntityCollectionNonGeneric stateData = (EntityCollectionNonGeneric)e.ContainedCollection;
MyStateProvinceEntity.FetchStatesByRegion(ref stateData,
CountryCombo.SelectedValue);
}
}
EDIT: prior to LLBLgen2 and databinding I would just manually fetch the states collection again, should I be taking the same approach?