G
Guest 20221009
Guest
So I am working on page with Telerik's web UI and I have added an updatepanel to do a partial update on the page. My control has Datalist that get it's data from a custom List<T> object based on the value of some Dropdownlist. This works fine when there is no updatepanel in use, but the moment I add the updatepanel, the datalist adds the new object without cleariing out the default item.
I have tried forcing the Datalist to clear on postback, just before creating the new object and I have had no luck. help
List<Conditions> conditions = new List<Conditions>();
if (IsPostBack)
{
DataList1.DataSource = null;
DataList1.DataBind();
}
conditions = Conditions.GetForecast(CityList.SelectedValue);
var current = Conditions.GetCurrentConditions(CityList.SelectedValue);
if (CurrentCondition != null)
{
CurrentImage.ImageUrl = "~/images/weathericons/" + current.Condition.ToLower() + ".png";
}
CurrentCity.Text = current.City;
CurrentCondition.Text = current.Condition;
CurrentTemp.Text = current.High;
CurrentHumidty.Text = current.Humidity;
I have tried forcing the Datalist to clear on postback, just before creating the new object and I have had no luck. help