private void grdData_GridRowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; FormatRowDisplay(ref row); DataColumnCollection DCCcurrent; //Find out if we are binding the grdData or selectedData if (row.Cells.Count == DCC.Count) { DCCcurrent = DCC; } else { DCCcurrent = DCCselected; } string itemId = row.Cells[DCC.IndexOf("Task_ID")].Text.Trim(); if (itemId == "0") { row.Style["display"] = "none"; } else { if (DCCcurrent.Contains("X") && DCCcurrent.Contains("Work Task")) { if (this.CanEditAOR && this.Type == "MoveWorkTask") { row.Cells[DCCcurrent.IndexOf("X")].Style["text-align"] = "center"; row.Cells[DCCcurrent.IndexOf("X")].Controls.Add(CreateCheckBox(row.Cells[DCCcurrent.IndexOf("Work Task")].Text)); } else if (this.CanEditAOR || (this.Type == "MoveSubTask" && this.CanEditWorkItem)) { row.Cells[DCCcurrent.IndexOf("X")].Style["text-align"] = "center"; row.Cells[DCCcurrent.IndexOf("X")].Controls.Add(CreateCheckBox(row.Cells[DCCcurrent.IndexOf("Work Task")].Text)); } if (this.CanViewWorkItem) { row.Cells[DCCcurrent.IndexOf("Work Task")].Style["text-align"] = "center"; row.Cells[DCCcurrent.IndexOf("Work Task")].Controls.Add(CreateLink(row.Cells[DCCcurrent.IndexOf("Task_ID")].Text, row.Cells[DCCcurrent.IndexOf("Work Task")].Text)); } } } }
private void FormatRowDisplay(ref GridViewRow row) { DataColumnCollection DCCcurrent; //Find out if we are binding the grdData or selectedData if (row.Cells.Count == DCC.Count) { DCCcurrent = DCC; } else { DCCcurrent = DCCselected; } for (int i = 0; i < row.Cells.Count; i++) { if (DCCcurrent[i].ColumnName.EndsWith("_ID")) { row.Cells[i].Style["display"] = "none"; } decimal val; bool isNumeric = decimal.TryParse(row.Cells[i].Text, out val); if (isNumeric) { row.Cells[i].Style["text-align"] = "center"; } } if (this.Type == "Task List" && DCCcurrent.Contains("X")) { row.Cells[DCCcurrent.IndexOf("X")].Style["display"] = "none"; } if (DCCcurrent.Contains("Product Version")) { row.Cells[DCCcurrent.IndexOf("Product Version")].Style["text-align"] = "center"; } }
private void FormatHeaderRowDisplay(ref GridViewRow row) { DataColumnCollection DCCcurrent; //Find out if we are binding the grdData or selectedData if (row.Cells.Count == DCC.Count) { DCCcurrent = DCC; } else { DCCcurrent = DCCselected; } for (int i = 0; i < row.Cells.Count; i++) { if (DCCcurrent[i].ColumnName.EndsWith("_ID")) { row.Cells[i].Style["display"] = "none"; } } if (DCCcurrent.Contains("X")) { row.Cells[DCCcurrent.IndexOf("X")].Text = ""; row.Cells[DCCcurrent.IndexOf("X")].Style["width"] = "35px"; } if (this.Type == "Task List" && DCCcurrent.Contains("X")) { row.Cells[DCCcurrent.IndexOf("X")].Style["display"] = "none"; } if (DCCcurrent.Contains("Work Task")) { row.Cells[DCCcurrent.IndexOf("Work Task")].Style["width"] = "75px"; } if (DCCcurrent.Contains("System(Task)")) { row.Cells[DCCcurrent.IndexOf("System(Task)")].Style["width"] = "100px"; } if (DCCcurrent.Contains("Product Version")) { row.Cells[DCCcurrent.IndexOf("Product Version")].Style["width"] = "60px"; } if (DCCcurrent.Contains("Production Status")) { row.Cells[DCCcurrent.IndexOf("Production Status")].Style["width"] = "75px"; } if (DCCcurrent.Contains("Priority")) { row.Cells[DCCcurrent.IndexOf("Priority")].Style["width"] = "55px"; } if (DCCcurrent.Contains("SR Number")) { row.Cells[DCCcurrent.IndexOf("SR Number")].Style["width"] = "55px"; } if (DCCcurrent.Contains("Assigned To")) { row.Cells[DCCcurrent.IndexOf("Assigned To")].Style["width"] = "110px"; } if (DCCcurrent.Contains("Primary Resource")) { row.Cells[DCCcurrent.IndexOf("Primary Resource")].Style["width"] = "110px"; } if (DCCcurrent.Contains("Secondary Tech. Resource")) { row.Cells[DCCcurrent.IndexOf("Secondary Tech. Resource")].Style["width"] = "110px"; } if (DCCcurrent.Contains("Primary Bus. Resource")) { row.Cells[DCCcurrent.IndexOf("Primary Bus. Resource")].Style["width"] = "110px"; } if (DCCcurrent.Contains("Secondary Bus. Resource")) { row.Cells[DCCcurrent.IndexOf("Secondary Bus. Resource")].Style["width"] = "110px"; } if (DCCcurrent.Contains("Status")) { row.Cells[DCCcurrent.IndexOf("Status")].Style["width"] = "100px"; } if (DCCcurrent.Contains("Percent Complete")) { row.Cells[DCCcurrent.IndexOf("Percent Complete")].Style["width"] = "65px"; } }