private void ClientInitial() { List <KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity(); //drpUnits.Items.Add(new ListItem("全厂", "00")); drpSUnits.Items.Add(new ListItem("【所有机组】", "")); foreach (KPI_UnitEntity Unit in UnitList) { drpSUnits.Items.Add(new ListItem(Unit.UnitName, Unit.UnitID)); drpUnits.Items.Add(new ListItem(Unit.UnitName, Unit.UnitID)); } DataTable Shifts = KPI_ShiftDal.GetShifts(); drpSShifts.Items.Add(new ListItem("【所有值次】", "")); foreach (DataRow dr in Shifts.Rows) { drpShifts.Items.Add(new ListItem(dr["Name"] + "值", dr["Name"] + "")); drpSShifts.Items.Add(new ListItem(dr["Name"] + "值", dr["Name"] + "")); } Shifts.Dispose(); DataTable PositionTable = KPI_PositionDal.GetDataTable(); foreach (DataRow dr in PositionTable.Rows) { drpPositions.Items.Add(new ListItem(dr["PositionName"] + "", dr["PositionID"] + "")); } PositionTable.Dispose(); }
private void BindPosition() { DataTable dt = KPI_PositionDal.GetDataTable(); ddlPosition.Items.Add(new ListItem("全部", "ALL")); foreach (DataRow dr in dt.Rows) { ddlPosition.Items.Add(new ListItem(dr["PositionName"].ToString(), dr["PositionID"].ToString())); } ddlPosition.SelectedValue = "ALL"; }