protected void uiGridViewPiolts_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView objData = (DataRowView)e.Row.DataItem; Pilot current = new Pilot(); current.LoadByPrimaryKey(Convert.ToInt32(objData["PilotID"].ToString())); Label temp = (Label)e.Row.FindControl("uiLabelName"); temp.Text = current.FirstName + " " + current.SecondName; Label temp2 = (Label)e.Row.FindControl("uiLabelStaffNo"); if (!current.IsColumnNull("StaffNo")) { temp2.Text = current.StaffNo.ToString(); } CheckBox IsPilot = (CheckBox)e.Row.FindControl("uiCheckBoxIsPilot"); if (!current.IsColumnNull("IsPilot")) IsPilot.Checked = current.IsPilot; else IsPilot.Checked = false; if (objData["PositionID"] != null) { Label pos = (Label)e.Row.FindControl("uiLabelPosition"); Position Currentpos = new Position(); Currentpos.LoadByPrimaryKey(Convert.ToInt32(objData["PositionID"].ToString())); pos.Text = Currentpos.Title; } } }
protected void uiGridViewCrew_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView objData = (DataRowView)e.Row.DataItem; Crew current = new Crew(); current.LoadByPrimaryKey(Convert.ToInt32(objData["CrewID"].ToString())); Label temp = (Label)e.Row.FindControl("uiLabelName"); temp.Text = current.Name; Label temp2 = (Label)e.Row.FindControl("uiLabelStaffNo"); if (!current.IsColumnNull("StaffNo")) { temp2.Text = current.StaffNo.ToString(); } if (objData["PositionID"] != null) { Label pos = (Label)e.Row.FindControl("uiLabelPosition"); Position Currentpos = new Position(); Currentpos.LoadByPrimaryKey(Convert.ToInt32(objData["PositionID"].ToString())); pos.Text = Currentpos.Title; } } }