Apr 06, 2011, 2:02 PM
Binding ajax based combo from the code behind
Hi,
I have two combos (County and City) and have set for the cboCity to be loaded with ajax, after user pics a county. This works fine, but what I need now is when that same page detects an id in url, I need to set this form in edit mode by filling it with the details from db.
The problem comes when I want to load cities combo from the server, no matter what I do, the list is empty.
I tried a few things, rebinding the data store with the exact code CitiesRefresh handler contains
Any help would be very much appreciated.
Thanks
I have two combos (County and City) and have set for the cboCity to be loaded with ajax, after user pics a county. This works fine, but what I need now is when that same page detects an id in url, I need to set this form in edit mode by filling it with the details from db.
The problem comes when I want to load cities combo from the server, no matter what I do, the list is empty.
I tried a few things, rebinding the data store with the exact code CitiesRefresh handler contains
protected void CitiesRefresh(object sender, StoreRefreshDataEventArgs e)
{
List<object> data = new List<object>();
var cities = _citiesBLL.Get(int.Parse(cboCounty.SelectedItem.Value));
foreach (var c in cities)
{
data.Add(new { Id = c.Id, Name = c.Name });
}
this.CitiesStore.DataSource = data;
this.CitiesStore.DataBind();
}
even tried to get a list of cities and manually add items, but no effect.Any help would be very much appreciated.
Thanks