john kanyora

john kanyora

  • NA
  • 242
  • 46.1k

data not loading on pageload with postback

Nov 9 2017 3:44 AM
am having a problem .data is not loading once the page loads..i have to choose an item on the dropdown list for it to load.i need it to load even before i choose any item on the drop down list..

this is my code behind.

protected void ddlPeriodStamp_SelectedIndexChanged(object sender, System.EventArgs e)
{
string selectedGroup = string.Empty;
DropDownList ddlItemGroup = (DropDownList)sender;

if (ddlItemGroup.SelectedValue != null)

TreatmentGroup = ddlItemGroup.SelectedValue;
ApplyGridFilter(ddlItemGroup.SelectedValue);


}

protected void ApplyGridFilter(string TreatmentGroup)
{
string selectedGroup = string.Empty;
DBDataSource1.State.BusinessObject.DataPump.FormFilters.Clear();
DBDataSource1.State.BusinessObject.DataPump.FormFilters.Add("TreatmentGroup", TreatmentGroup);
DBDataSource1.State.BusinessObject.Fill(null);
MedicalSchemeDetailGrid.DataBind();
}
protected void Page_LoadComplete(object sender, System.EventArgs e)
{

if (!this.IsPostBack)
ApplyGridFilter(string.Empty);
}

Answers (7)