protected Control BuildInput(IReportParameter parameter, bool autoPostBack) { Control control; switch (parameter.ReportParameterInputType) { case ReportParameterInputType.Hidden: HiddenField hiddenField = new HiddenField(); hiddenField.ID = parameter.Name; hiddenField.Value = GetParameterValue(parameter); control = hiddenField; break; case ReportParameterInputType.Select: DropDownList dropDownList = new DropDownList(); dropDownList.ID = parameter.Name; dropDownList.CssClass = parameter.Name; IList <IReportParameterValue> validValues = parameter.ValidValues(this.GetParameterValue); ListItem[] listItems; Boolean hide = false; // this report need to show the Group name as well in the drop down if (TheReport().Id == "E6A6F567-2E14-433A-ABCA-0E97DA8A1595") { listItems = new ListItem[validValues.Count + 1]; string DrillThroughBussinessId = string.Empty; if (Request.QueryString.HasKeys() && Request.QueryString.GetValues("drillthrough") != null) { DrillThroughBussinessId = Request.QueryString.GetValues("drillthrough")[0].ToString(); } else { if (SoftwareSystemComponentState.Dealer != null) { DrillThroughBussinessId = SoftwareSystemComponentState.Dealer.GetValue().Id.ToString(); } } //check if page request is made from the PerformanceManagementPage string parentCallingPage = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"] as object) .ToUpper(); string pmrType = string.Empty; if (Request.QueryString.HasKeys() && Request.QueryString.GetValues("type") != null) { pmrType = Request.QueryString.GetValues("type")[0]; } if (parentCallingPage.Contains("PERFORMANCE") || parentCallingPage.Contains("DEALERREPORT") || pmrType == "pmr") { hide = true; } ListItem firstListItem = new ListItem(SoftwareSystemComponentState.DealerGroup.GetValue().Name, GetSelectedDealersId()); firstListItem.Selected = false; listItems[0] = firstListItem; int i = 1; foreach (IReportParameterValue value in validValues) { ListItem listItem = new ListItem(value.Label, value.Value); listItem.Selected = DrillThroughBussinessId == value.Value ? true : value.Selected; listItems[i++] = listItem; } } else { listItems = new ListItem[validValues.Count]; int i = 0; foreach (IReportParameterValue value in validValues) { ListItem listItem = new ListItem(value.Label, value.Value); listItem.Selected = value.Selected; listItems[i++] = listItem; } } //Trade analyzer and Avg Imm. wholesale dealer report does not require Delaer list to be displayed. if ((TheReport().Id.ToLower() == "c625a438-4429-4a8c-a3a2-366805acddf9" || TheReport().Id.ToLower() == "59c0e4ef-95bb-4031-8b61-28020d9e91f9") && Request.QueryString.HasKeys() && Request.QueryString.GetValues("type") != null && parameter.Name.Contains("SelectedDealerId")) { string pmrType = Request.QueryString.GetValues("type")[0]; if (pmrType == "pmr") { hide = true; } } dropDownList.Items.AddRange(listItems); autoPostBack |= String.Equals(parameter.Name, "varToggleRow"); dropDownList.AutoPostBack = autoPostBack; if (autoPostBack) { dropDownList.SelectedIndexChanged += DropDown_SelectedIndexChanged; } control = dropDownList; if (hide) { control.Visible = false; } break; case ReportParameterInputType.Text: TextBox textBox = new TextBox(); textBox.ID = parameter.Name; textBox.CssClass = parameter.Name; textBox.Text = GetParameterValue(parameter); textBox.AutoPostBack = autoPostBack; control = textBox; break; case ReportParameterInputType.Checkbox: CheckBox checkBox = new CheckBox(); checkBox.ID = parameter.Name; checkBox.CssClass = parameter.Name; checkBox.Checked = ("True".Equals(GetParameterValue(parameter)) || "1".Equals(GetParameterValue(parameter))); checkBox.AutoPostBack = autoPostBack; control = checkBox; break; default: throw new ArgumentException("Method not implemented for input type"); } return(control); }
protected Control BuildInput(IReportParameter parameter, bool autoPostBack) { Control control; switch (parameter.ReportParameterInputType) { case ReportParameterInputType.Hidden: HiddenField hiddenField = new HiddenField(); hiddenField.ID = parameter.Name; hiddenField.Value = GetParameterValue(parameter); control = hiddenField; break; case ReportParameterInputType.Select: DropDownList dropDownList = new DropDownList(); dropDownList.ID = parameter.Name; dropDownList.CssClass = parameter.Name + " seletMargin"; IList <IReportParameterValue> validValues = parameter.ValidValues(GetParameterValue); var listItems = new ListItem[validValues.Count]; int i = 0; foreach (IReportParameterValue value in validValues) { ListItem listItem = new ListItem(value.Label, value.Value); listItem.Selected = value.Selected; listItems[i++] = listItem; } dropDownList.Items.AddRange(listItems); autoPostBack |= String.Equals(parameter.Name, "varToggleRow"); dropDownList.AutoPostBack = autoPostBack; if (autoPostBack) { dropDownList.SelectedIndexChanged += DropDown_SelectedIndexChanged; } control = dropDownList; break; case ReportParameterInputType.Text: TextBox textBox = new TextBox(); textBox.ID = parameter.Name; textBox.CssClass = parameter.Name; textBox.Text = GetParameterValue(parameter); textBox.AutoPostBack = autoPostBack; control = textBox; break; case ReportParameterInputType.Checkbox: CheckBox checkBox = new CheckBox(); checkBox.ID = parameter.Name; checkBox.CssClass = parameter.Name; checkBox.Checked = ("True".Equals(GetParameterValue(parameter)) || "1".Equals(GetParameterValue(parameter))); checkBox.AutoPostBack = autoPostBack; control = checkBox; break; default: throw new ArgumentException("Method not implemented for input type"); } return(control); }