void ddlItemType_SelectedIndexChanged(object sender, EventArgs e) { try { var dt = LookupsBO.GetLoadList().Tables[0]; //update ddlDates: var col = new ListItemCollection(); ListItem it; if (ddlItemType.SelectedIndex != 0) { btnUpload.Visible = true; var strOIType = ddlItemType.SelectedValue; var select = String.Format("OIType = {0} and ParentLoadID = 0", strOIType); var drows = dt.Select(select, "LoadDate DESC"); string _value; string _text; it = new ListItem("", "0"); col.Add(it); foreach (var dr in drows) { _value = dr["LoadID"].ToString(); _text = "Load Date: " + ((DateTime)dr["LoadDate"]).ToString("MMM dd, yyyy") + ", " + dr["LoadDesc"].ToString() + ", DueDate: " + ((DateTime)dr["DueDate"]).ToString("MMM dd, yyyy"); if (dr["ArchiveDate"] != DBNull.Value) { _text = _text + " (Archived)"; } it = new ListItem(_text, _value); col.Add(it); } if (ddlItemType.SelectedValue == "6") { tr_date_of_report.AddDisplay(); } else { tr_date_of_report.AddDisplayNone(); } } else { btnUpload.Visible = false; } if (col.Count == 1) { it = new ListItem("There is no loaded data found", "0"); col.Add(it); } ddlPrevLoad.DataSource = col; ddlPrevLoad.DataValueField = "Value"; ddlPrevLoad.DataTextField = "Text"; ddlPrevLoad.DataBind(); } catch (Exception ex) { //lblError.Text = ex.Message; } }
public void InitControls() { tblSearch.Visible = DisplaySearchFields; tblSubmit.Visible = DisplaySubmitSection; if (DisplaySearchFields) btnValHistory.Visible = true; //LoadListTable = Lookups.GetLoadFullInfoList(false).Copy(); LoadListTable = LookupsBO.GetLoadList().Tables[0].Copy(); if (!LoadID_IsRequired) { var dr = LoadListTable.NewRow(); dr["LoadID"] = 0; dr["LoadDesc"] = ""; LoadListTable.Rows.InsertAt(dr, 0); } ddlLoad.DataSource = LoadListTable; ddlLoad.DataValueField = "LoadID"; ddlLoad.DataTextField = "LoadDesc"; ddlLoad.DataBind(); lblSource.Text = ""; //init Organizations list: var dto = LookupsBO.GetUniqueOrganizationList().Tables[0].Copy(); var dro = dto.NewRow(); dro["Organization"] = OIConstants.OpenItemsGridFilter_TotalUniverse; dto.Rows.InsertAt(dro, 0); if (AddWorkloadFilterValue) { dro = dto.NewRow(); dro["Organization"] = OIConstants.OpenItemsGridFilter_MyWorkload; dto.Rows.InsertAt(dro, 1); } else if (AddBudgetDivisionFilterValue) { dro = dto.NewRow(); dro["Organization"] = OIConstants.OpenItemsGridFilter_BDResponsibility; dto.Rows.InsertAt(dro, 1); } ddlViewFilter.DataSource = dto; ddlViewFilter.DataValueField = "Organization"; ddlViewFilter.DataTextField = "Organization"; ddlViewFilter.DataBind(); }