示例#1
0
 protected void FarmDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (FarmDropDownList.SelectedValue.ToString().Equals("0"))
     {
         PlotDropDownList.Items.Clear();
         PlotDropDownList.Items.Add(new ListItem("All Plots", "0"));
     }
     else
     {
         try
         {
             int farmId = 0;
             farmId = int.Parse(FarmDropDownList.SelectedValue.ToString());
             // Get the common web service instance.
             ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
             FarmService.FarmService farmService   = serviceLoader.GetFarm();
             PlotDropDownList.DataSource     = farmService.GetPlotListForFarm(farmId);
             PlotDropDownList.DataValueField = "PlotId";
             PlotDropDownList.DataTextField  = "PlotName";
             PlotDropDownList.DataBind();
             PlotDropDownList.Items.Insert(0, new ListItem("All Plots", "0"));
         }
         catch (Exception exception)
         {
             log.Error("UNKNOWN ERROR IN SEARCH FARM FARM SELECTION CHANGED:", exception);
             ErrorLiteral.Text = "UNKNOWN ERROR: Please Contact Administrator";
         }
     }
 }