public static void BindGrid(this GridView grid, object dataSource, string emptyText) { grid.DataSource = dataSource; grid.DataBind(); if (grid.Rows.Count == 0) { var table = new Table(); table.CssClass = grid.CssClass; var tr = new TableHeaderRow(); foreach (DataControlField column in grid.Columns) { if (column.Visible) { var th = new TableHeaderCell(); th.Width = column.HeaderStyle.Width; th.Text = column.HeaderText; tr.Controls.Add(th); } } table.Controls.Add(tr); if (!string.IsNullOrEmpty(emptyText)) { var emptyRow = new TableRow(); var emptyCell = new TableCell(); emptyCell.CssClass = "empty"; emptyCell.ColumnSpan = tr.Controls.Count; emptyCell.Text = emptyText; emptyRow.Controls.Add(emptyCell); table.Controls.Add(emptyRow); } grid.Parent.Controls.Add(table); } }
private void CreateHeaderRow() { TableHeaderRow headerRow = new TableHeaderRow { CssClass = "titles" }; headerRow.Cells.Add(new TableHeaderCell { Text = "Visitor Language" }); headerRow.Cells.Add(new TableHeaderCell { Text = "Fallback Language" }); tblFallbackLanguages.Rows.Add(headerRow); }
public static Table BuildFieldDescTable(IEnumerable<Tuple<string, string>> dataRows) { Table table = new Table(); TableHeaderRow thr = new TableHeaderRow(); TableCell hc1 = new TableCell(); TableCell hc2 = new TableCell(); hc1.Text = "Field"; hc2.Text = "Description"; thr.Cells.Add(hc1); thr.Cells.Add(hc2); foreach (Tuple<string, string> dataRow in dataRows) { TableRow r = new TableRow(); TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); c1.Text = dataRow.Item1; c2.Text = dataRow.Item2; r.Cells.Add(c1); r.Cells.Add(c2); table.Rows.Add(r); } return table; }
protected void Page_Load(object sender, EventArgs e) { for (int rowCount = 0; rowCount < brochure.Length; rowCount++) { TableRow row = new TableRow(); row.ID = "row" + rowCount; table1.Rows.Add(row); for (int colCount = 0; colCount < 2; colCount++) { TableCell cell = new TableCell(); cell.ID = String.Format("cell {0}{1}", rowCount, colCount); row.Cells.Add(cell); if (colCount == 0) { Label label = new Label(); label.ID = String.Format("label{0}{1}", rowCount, colCount); label.Text = brochure[rowCount]; cell.Controls.Add(label); } else { TextBox textBox = new TextBox(); textBox.ID = String.Format("textBox{0}{1}", rowCount, colCount); Debug.WriteLine(textBox.ID); cell.Controls.Add(textBox); } } } TableHeaderRow tableHeader = new TableHeaderRow(); TableHeaderCell cell1 = new TableHeaderCell(); TableHeaderCell cell2 = new TableHeaderCell(); cell1.Text = "Brochure"; cell2.Text = "Antal"; tableHeader.Cells.Add(cell1); tableHeader.Cells.Add(cell2); table1.Rows.AddAt(0, tableHeader); }
private void BuildCampaignsTable() { TableHeaderCell hCell = null; TableHeaderRow hRow = null; this.campaignsTable.Rows.Clear(); hRow = new TableHeaderRow(); hCell = new TableHeaderCell(); hCell.Text = "Id"; hCell.ID = "campaignIdHeaderTH"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); hCell = new TableHeaderCell(); hCell.Text = "Description"; hCell.ID = "campaignDescriptionHeaderTH"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); hCell = new TableHeaderCell(); hCell.Text = "Status"; hCell.ID = "statusHeaderTH"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); this.campaignsTable.Rows.Add(hRow); this.countLabel.Text = "Campaign Schedules Found: 0"; this.campaignsTable.Attributes.Add("class", "sortable EditorTables"); }
private void CreateHeaderRow(IEnumerable<Language> languages) { // The columns are the available languages. TableHeaderRow headerRow = new TableHeaderRow { CssClass = "titles" }; headerRow.Cells.Add(new TableHeaderCell { Text = "Page" }); foreach (Language language in languages) headerRow.Cells.Add(new TableHeaderCell { Text = "<img src=\"" + language.IconUrl + "\" /> " + language.Title }); tblPageTranslations.Rows.Add(headerRow); }
protected void Button1_Click(object sender, EventArgs e) { if (!CtoF.Checked && !FtoC.Checked || CtoF.Checked && FtoC.Checked) { ModelState.AddModelError(String.Empty, "Välj konvertering från Celsius till Fahrenheit eller från Fahrenheit till Celsius"); } if (IsValid) { var start = int.Parse(Start.Text); var end = int.Parse(End.Text); var step = int.Parse(Step.Text); var thead = new TableHeaderRow(); var theadC = new TableHeaderCell { Text = "°C" }; var theadF = new TableHeaderCell { Text = "°F" }; if (CtoF.Checked) { thead.Cells.Add(theadC); thead.Cells.Add(theadF); } else { thead.Cells.Add(theadF); thead.Cells.Add(theadC); } Table.Rows.Add(thead); for (int temp = start; temp <= end; temp += step) { var trow = new TableRow(); trow.Cells.Add(new TableCell { Text = temp.ToString() }); if (CtoF.Checked) { trow.Cells.Add(new TableCell { Text = TemperatureConverter.CelsiusToFahrenheit(temp).ToString() }); } else { trow.Cells.Add(new TableCell { Text = TemperatureConverter.FahrenheitToCelsius(temp).ToString() }); } Table.Rows.Add(trow); } Table.Visible = true; } else { Table.Visible = false; } }
protected void Page_Init(object sender, EventArgs e) { if (Request.Cookies["UserSettings"] != null) { if (Request.Cookies["UserSettings"]["Name"] != null) linkBtnUsername.Text = Request.Cookies["UserSettings"]["Name"]; else Response.Redirect("login.aspx"); } else Response.Redirect("login.aspx"); if (Session["userID"] == null) Response.Redirect("board.aspx"); List<string> results = (List<string>)Session["links"]; TableHeaderRow thr = new TableHeaderRow(); TableHeaderCell thc = new TableHeaderCell(); TableHeaderCell thc1 = new TableHeaderCell(); TableHeaderCell thc2 = new TableHeaderCell(); TableHeaderCell thc3 = new TableHeaderCell(); thr.Cells.Add(thc); thc.Text = "Title"; thr.Cells.Add(thc1); thc1.Text = "Start Date"; thr.Cells.Add(thc2); thc2.Text = "End Date"; thr.Cells.Add(thc3); thc3.Text = "Assignee"; TableSearchResults.Rows.Add(thr); foreach (string li in results) { TableRow tr = new TableRow(); string[] str = li.Split('+'); TableCell tc = new TableCell(); TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); TableCell tc3 = new TableCell(); tc.Text = str[0]; tc1.Text = str[1]; tc2.Text = str[2]; tc3.Text = str[3]; tr.Cells.Add(tc); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tr.Cells.Add(tc3); TableSearchResults.Rows.Add(tr); } }
private void displayResults() { if (Session["recallList"] == null) { Response.Redirect("Home.asp"); // Session Timeout } // Get the search results... List<RecallFoodAlertData> recallList = (List<RecallFoodAlertData>)Session["recallList"]; recallList = recallList.OrderBy(t => t.Classification).ThenByDescending(t => t.ReportDate).ToList<RecallFoodAlertData>(); // Build the table rows and display the results TableHeaderRow thr = new TableHeaderRow(); System.Text.StringBuilder resultsHTML = new System.Text.StringBuilder(); resultsDiv.InnerHtml = "No results found"; foreach (RecallFoodAlertData rfad in recallList) { string imageUrl = ""; switch (rfad.Classification.ToUpper()) { case "CLASS I": imageUrl = "img/risk-high.png"; break; case "CLASS II": imageUrl = "img/risk-med.png"; break; case "CLASS III": imageUrl = "img/risk-low.png"; break; default: imageUrl = "img/No-Data.png"; break; } resultsHTML.Append("<div class='search-result-container large-12 medium-12 small-12 columns'>"); resultsHTML.Append("<div class='search-result-box box'>"); string hrefUrl = string.Format("Details.aspx?recall={0}", rfad.RecallNumber); resultsHTML.Append("<h3><a href='" + hrefUrl + "'>" + rfad.FirmName + "</a></h3>"); resultsHTML.Append("<div class='search-result-details large-11 medium-11 small-9 columns'>"); resultsHTML.Append("<h4>Initiation Date: " + rfad.InitiationDate.ToString("MM/dd/yyyy") + "</h4>"); resultsHTML.Append("<p>" + rfad.ProductDescription + "</p>"); resultsHTML.Append("</div>"); resultsHTML.Append("<div class='no-pad-right large-1 medium-1 small-3 columns'>"); resultsHTML.Append("<img class='risk-level right' src='" + imageUrl + "' />"); resultsHTML.Append("</div></div></div>"); } if (resultsHTML.Length > 0) { resultsDiv.InnerHtml = resultsHTML.ToString(); } }
protected void btnAddFoodItemToShoppingList_Click(object sender, EventArgs e) { double num; string amount = txtAmount.Text; bool isNum = Double.TryParse(amount, out num); if (amount != "") { if (isNum) { lbFoodItemID.Items.Add(ddlFoodItem.SelectedValue); lbFoodItemID.Items[lbFoodItemID.Items.Count - 1].Value = txtAmount.Text; tbFoodItem.Rows.Clear(); TableHeaderRow tbHeaderRow = new TableHeaderRow(); tbFoodItem.Rows.Add(tbHeaderRow); TableHeaderCell tbHeaderCellName = new TableHeaderCell(); TableHeaderCell tbHeaderCellAmount = new TableHeaderCell(); tbHeaderCellName.Text = "Name"; tbHeaderCellAmount.Text = "Amount"; tbHeaderRow.Cells.Add(tbHeaderCellName); tbHeaderRow.Cells.Add(tbHeaderCellAmount); for (int k = 0; k < lbFoodItemID.Items.Count; k++) { string foodid = lbFoodItemID.Items[k].Text; OleDbCommand command = new OleDbCommand("SELECT * FROM FoodItem WHERE FoodItemID = " + foodid.ToString(), myConnection); command.CommandType = CommandType.Text; OleDbDataReader reader = command.ExecuteReader(); bool notEoF = reader.Read(); while (notEoF) { TableRow tbRow = new TableRow(); tbFoodItem.Rows.Add(tbRow); TableCell tbCellName = new TableCell(); TableCell tbCellAmount = new TableCell(); tbCellName.Text = reader["Name"].ToString(); tbCellAmount.Text = lbFoodItemID.Items[k].Value + " " + reader["UnitType"].ToString(); tbRow.Cells.Add(tbCellName); tbRow.Cells.Add(tbCellAmount); notEoF = reader.Read(); } reader.Close(); } } else { lblAmount.Text = "Amount is Invalid"; } } else { lblAmount.Text = "Amount Required"; } }
protected void RenderTable(bool CelciusToFahrenheit, int startValue, int endValue, int stepValue) { //skapar tableheader var thCell1 = new TableHeaderCell(); var thCell2 = new TableHeaderCell(); if (CelciusToFahrenheit) { thCell1.Controls.Add(new LiteralControl("°C")); thCell2.Controls.Add(new LiteralControl("°F")); } else { thCell1.Controls.Add(new LiteralControl("°F")); thCell2.Controls.Add(new LiteralControl("°C")); } var thRow = new TableHeaderRow(); thRow.Controls.Add(thCell1); thRow.Controls.Add(thCell2); tblResults.Controls.Add(thRow); //skapar tablebody while (startValue <= endValue) { var row = new TableRow(); var cell = new TableCell(); cell.Controls.Add( new LiteralControl( startValue.ToString())); row.Controls.Add(cell); cell = new TableCell(); if (CelciusToFahrenheit) { cell.Controls.Add( new LiteralControl( TemperatureConverter.CelciusToFahrenheit(startValue).ToString())); } else { cell.Controls.Add( new LiteralControl( TemperatureConverter.FahrenheitToCelcius(startValue).ToString())); } row.Controls.Add(cell); tblResults.Rows.Add(row); startValue += stepValue; } }
protected void Page_Load(object sender, EventArgs e) { using (var conn = new SqlConnection("Server=(local);DataBase=Nutrition;Integrated Security=SSPI")) { using (var command = new SqlCommand("dbo.Food_Nutrition_Get", conn) { CommandType = CommandType.StoredProcedure }) { conn.Open(); var reader = command.ExecuteReader(CommandBehavior.CloseConnection); if (reader.HasRows) { TableHeaderRow header = new TableHeaderRow(); header.Cells.Add(new TableHeaderCell { Text = "Food Name" }); header.Cells.Add(new TableHeaderCell { Text = "Calories" }); header.Cells.Add(new TableHeaderCell { Text = "Water" }); header.Cells.Add(new TableHeaderCell { Text = "Protein" }); header.Cells.Add(new TableHeaderCell { Text = "Lipid" }); header.Cells.Add(new TableHeaderCell { Text = "Carbohydrate" }); header.Cells.Add(new TableHeaderCell { Text = "Fiber" }); header.Cells.Add(new TableHeaderCell { Text = "Sugar" }); header.Cells.Add(new TableHeaderCell { Text = "Calcium" }); header.Cells.Add(new TableHeaderCell { Text = "Iron" }); header.TableSection = TableRowSection.TableHeader; this.domainsTable.Rows.Add(header); TableRow tr; while (reader.Read()) { tr = new TableRow(); tr.Attributes.Add("onclick", "SelectFood(this);"); tr.Attributes.Add("foodkey", reader["Food_Key"].ToString()); tr.Attributes.Add("foodunitkey", reader["Food_Unit_Key"].ToString()); tr.Attributes.Add("foodname", reader["Name"].ToString()); tr.Cells.Add(new TableCell { Text = reader["Name"].ToString() }); tr.Cells.Add(new TableCell { Text = reader["Calories"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Water"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Protein"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Lipid"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Carbohydrate"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Fiber"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Sugar"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Calcium"].ToString(), CssClass = "Number" }); tr.Cells.Add(new TableCell { Text = reader["Iron"].ToString(), CssClass = "Number" }); this.domainsTable.Rows.Add(tr); } } conn.Close(); } } }
private void CreateHeaderRow(Table table) { using (TableHeaderRow header = new TableHeaderRow()) { header.TableSection = TableRowSection.TableHeader; this.AddHeaderCell(header, "340px", Titles.Comment); this.AddHeaderCell(header, "50px", Titles.Upload, "nopadding"); this.AddHeaderCell(header, "240px", Titles.Progress); this.AddHeaderCell(header, "", Titles.FilePath); table.Rows.Add(header); } }
/// <summary> /// Init the table to view informations /// </summary> private void initTable() { TableHeaderRow header = new TableHeaderRow(); header.CssClass = "tableAlternateHeader"; InscriptionsTable.Controls.Add(header); TableCell hProjects = new TableCell(); hProjects.Text = "Projets"; header.Controls.Add(hProjects); TableCell hStudents = new TableCell(); hStudents.Text = "Etudiant inscrits"; header.Controls.Add(hStudents); }
protected void Page_Load(object sender, EventArgs e) { Ado.ClasesComunes.Periodo _periodoActual = new Ado.ClasesComunes.Periodo(); IMetodosAdministrador _metAdministrador = new MetodosAdministrador(); _periodoActual = _metAdministrador.UltimoPeriodo(); if (_periodoActual != null) { LinkedList<string> _encabezados = new LinkedList<string>(); _encabezados.AddLast("Identificación"); _encabezados.AddLast("Fecha de Inicio"); _encabezados.AddLast("Fecha de Fin"); _encabezados.AddLast("Estado"); _encabezados.AddLast("Modalidad"); _encabezados.AddLast("Año"); _encabezados.AddLast("Número de Periodo"); TableHeaderRow _encabezado = new TableHeaderRow(); foreach (var _elemento in _encabezados) { TableHeaderCell _celda = new TableHeaderCell(); _celda.Text = _elemento; _encabezado.Cells.Add(_celda); } LinkedList<string> _periodo = new LinkedList<string>(); _periodo.AddLast(_periodoActual.Id_Periodo.ToString()); _periodo.AddLast(_periodoActual.Fec_Inicio.Date.ToString()); _periodo.AddLast(_periodoActual.Fec_Fin.Date.ToString()); _periodo.AddLast(_periodoActual.Txt_Estado); _periodo.AddLast(_periodoActual.Txt_Modalidad); _periodo.AddLast(_periodoActual.Num_Anno.ToString()); _periodo.AddLast(_periodoActual.Num_Periodo.ToString()); TableRow _fila = new TableRow(); foreach (var _elemento in _periodo) { TableCell _celda = new TableCell(); _celda.Text = _elemento; _fila.Cells.Add(_celda); } //Lleno tabla tblPeriodo.Rows.Add(_encabezado); tblPeriodo.Rows.Add(_fila); } else { //Agrego Label que diga que no hay un periodo de recepcion en curso actualmente. lblSinPeriodo.Text = "-- El sistema no tiene actualmente un periodo de recepción de solicitudes en curso actualmente. --"; } }
protected void Page_Load(object sender, EventArgs e) { int shoppingListID = 0; if (Request.QueryString["ShoppingListID"] != null && Request.QueryString["ShoppingListID"] != "") { shoppingListID = Convert.ToInt32(Request.QueryString["ShoppingListID"]); } else { Response.Redirect("ShoppingListHistory.aspx"); } myConnection.ConnectionString = connstr; myConnection.Open(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM ShoppingList WHERE ShoppingListID = " + shoppingListID, myConnection); cmd.CommandType = CommandType.Text; OleDbDataReader reader = cmd.ExecuteReader(); bool notEoF = reader.Read(); while (notEoF) { lblCreatedDate.Text = reader["CreatedDate"].ToString().Split(' ')[0].ToString(); notEoF = reader.Read(); } reader.Close(); TableHeaderRow tbHeaderRow = new TableHeaderRow(); tbFoodItem.Rows.Add(tbHeaderRow); TableHeaderCell tbHeaderCellName = new TableHeaderCell(); TableHeaderCell tbHeaderCellAmount = new TableHeaderCell(); tbHeaderCellName.Text = "Name"; tbHeaderCellAmount.Text = "Amount"; tbHeaderRow.Cells.Add(tbHeaderCellName); tbHeaderRow.Cells.Add(tbHeaderCellAmount); OleDbCommand cmd2 = new OleDbCommand("SELECT * FROM FoodItem AS f INNER JOIN ShoppingListFoodItem AS sf ON f.FoodItemID = sf.FoodItemID WHERE sf.ShoppingListID = " + shoppingListID, myConnection); cmd2.CommandType = CommandType.Text; OleDbDataReader reader2 = cmd2.ExecuteReader(); bool notEoF2 = reader2.Read(); while (notEoF2) { TableRow tbRow = new TableRow(); tbFoodItem.Rows.Add(tbRow); TableCell tbCellName = new TableCell(); TableCell tbCellAmount = new TableCell(); tbCellName.Text = reader2["Name"].ToString(); tbCellAmount.Text = reader2["Amount"].ToString() + " " + reader2["UnitType"].ToString(); tbRow.Cells.Add(tbCellName); tbRow.Cells.Add(tbCellAmount); notEoF2 = reader2.Read(); } reader2.Close(); }
protected void convertButton_Click(object sender, EventArgs e) { if (IsValid) { TempTable.Visible = true; var StartTemp = int.Parse(startTemp.Text); var EndTemp = int.Parse(endTemp.Text); var TempStep = int.Parse(tempStep.Text); TableHeaderRow tableHeaderRow = new TableHeaderRow(); TableHeaderCell tableHeaderCell = new TableHeaderCell(); TableHeaderCell tableHeaderCellFarenheit = new TableHeaderCell(); if (CelFa.Checked) { CellToFar.Text = "°C"; FarToCell.Text = "°F"; } else if (FarCe.Checked) { CellToFar.Text = "°F"; FarToCell.Text = "°C"; } for (int temp = StartTemp; temp <= EndTemp; temp += TempStep) { TableCell cellOne = new TableCell(); TableCell cellTwo = new TableCell(); TableRow row = new TableRow(); TempTable.Rows.Add(row); TempTable.Rows.Add(tableHeaderRow); row.Cells.Add(cellOne); row.Cells.Add(cellTwo); if (CelFa.Checked == true) { cellOne.Text = temp.ToString(); cellTwo.Text = TemperatureConverter.CelsiusToFahrenheit(temp).ToString(); } else if (FarCe.Checked == true) { cellOne.Text = temp.ToString(); cellTwo.Text = TemperatureConverter.FahrenheitToCelsius(temp).ToString(); } } } }
public void CreateUserBookingTable() { UserName.Text = string.Format("UserName: {0}", UserDB.GetUserById(1).UserName); foreach (var booking in BookingDB.GetBookingsByUserId(1)) { TableHeaderRow tbHeaderRow = new TableHeaderRow() { }; TableHeaderCell tbHeaderCell = new TableHeaderCell() { Text = string.Format("<b>Booking id:</b> {0}", booking.Id), ColumnSpan = 6 }; tbHeaderRow.Cells.Add(tbHeaderCell); MyBookingsTable.Rows.Add(tbHeaderRow); TableHeaderRow tbHeaderRowSession = new TableHeaderRow(); tbHeaderRowSession.Cells.Add(new TableHeaderCell() { Text = "Selected" }); tbHeaderRowSession.Cells.Add(new TableHeaderCell() { Text = "Session Id", CssClass = "no-spacing-right" }); tbHeaderRowSession.Cells.Add(new TableHeaderCell() { Text = "Date" }); tbHeaderRowSession.Cells.Add(new TableHeaderCell() { Text = "Time" }); tbHeaderRowSession.Cells.Add(new TableHeaderCell() { Text = "Court" }); tbHeaderRowSession.Cells.Add(new TableHeaderCell() { Text = "Session Cost" }); MyBookingsTable.Rows.Add(tbHeaderRowSession); foreach (var session in SessionDB.GetAllSessionsByBookingId(booking.Id)) { TableRow trSession = new TableRow(); SessionItemCheckBox cb = new SessionItemCheckBox() {ID = session.Id.ToString() ,Session = session }; TableCell tbCell = new TableCell(); ((IParserAccessor)tbCell).AddParsedSubObject(cb); trSession.Cells.Add(tbCell); trSession.Cells.Add(new TableCell() { Text = session.Id.ToString(), CssClass = "no-spacing-right" }); trSession.Cells.Add(new TableCell() { Text = session.StartDateTime.ToShortDateString() }); trSession.Cells.Add(new TableCell() { Text = session.StartDateTime.ToShortTimeString() + "-" + session.EndDateTime.ToShortTimeString() }); trSession.Cells.Add(new TableCell() { Text = session.Court.Name + session.CourtId }); trSession.Cells.Add(new TableCell() { Text = session.SessionCost.ToString() }); MyBookingsTable.Rows.Add(trSession); } TableRow tbRow = new TableRow(); tbRow.Cells.Add(new TableCell() { Text = "<hr>", ColumnSpan = 6 }); MyBookingsTable.Rows.Add(tbRow); } }
private TableHeaderRow GetHeaderRow() { using (TableHeaderRow row = new TableHeaderRow()) { row.TableSection = TableRowSection.TableHeader; row.Cells.Add(this.GetHeaderCell(Titles.Type, "TransactionTypeSelect", false, 80)); row.Cells.Add(this.GetHeaderCell(Titles.Store, "StoreSelect", false, 140)); row.Cells.Add(this.GetHeaderCell(Titles.ItemCode, "ItemCodeInputText", false, 90)); row.Cells.Add(this.GetHeaderCell(Titles.ItemName, "ItemSelect", false, 0)); row.Cells.Add(this.GetHeaderCell(Titles.Unit, "UnitSelect", false, 120)); row.Cells.Add(this.GetHeaderCell(Titles.Quantity, "QuantityInputText", true, 120)); row.Cells.Add(this.GetHeaderCell(Titles.Action, null, false, 120)); return row; } }
/// <summary> /// instantiate labels and expand button /// </summary> /// <param name="parent">control to instantiate in</param> private static void InstantiateTitles(Control parent) { TableHeaderRow labelsRow = new TableHeaderRow(); labelsRow.ID = PatientBannerControlIds.ZoneTwoPermanent; WebControl subsectionOne = InstantiateTitle(labelsRow, PatientBannerControlIds.SubsectionOneTitle); WebControl subsectionTwo = InstantiateTitle(labelsRow, PatientBannerControlIds.SubsectionTwoTitle); InstantiateTitle(labelsRow, PatientBannerControlIds.SubsectionThreeTitle); InstantiateTitle(labelsRow, PatientBannerControlIds.SubsectionFourTitle); WebControl subsectionFive = InstantiateImageTitle(labelsRow, PatientBannerControlIds.SubsectionFive, PatientBannerControlIds.SubsectionFiveTitle, PatientBannerControlIds.AllergyIcon); InstantiateExpandImage(labelsRow); InstantiateAddressSummary(subsectionOne); InstantiateContactDetailsSummary(subsectionTwo); InstantiateAllergySummary(subsectionFive); parent.Controls.Add(labelsRow); }
void lookup() { DataGetter dataGetter = new DataGetter(); List<DateTime> departs = dataGetter.Depart; List<DateTime> arrives = dataGetter.Arrive; TableTimes.Rows.Clear (); TableHeaderRow hRow = new TableHeaderRow (); TableTimes.Rows.Add (hRow); if (departs.Count == 0 || arrives.Count == 0) { TableHeaderCell cell = new TableHeaderCell (); cell.Text = "No Trains Found"; cell.CssClass = "text-center"; hRow.Cells.Add (cell); hRow.CssClass = "danger"; } else { TableHeaderCell departHeaderCell = new TableHeaderCell (); departHeaderCell.Text = "Depart"; departHeaderCell.CssClass = "text-center"; hRow.Cells.Add (departHeaderCell); TableHeaderCell arriveHeaderCell = new TableHeaderCell (); arriveHeaderCell.Text = "Arrive"; arriveHeaderCell.CssClass = "text-center"; hRow.Cells.Add (arriveHeaderCell); for (int i = 0; i < departs.Count && i < arrives.Count; i++) { if (Trip.Day > 0 || (Trip.Day == 0 && departs [i] > DateTime.Now)) { TableCell departCell = new TableCell (); departCell.Text = departs [i].ToShortTimeString (); departCell.CssClass = "text-center"; TableCell arriveCell = new TableCell (); arriveCell.Text = arrives [i].ToShortTimeString (); arriveCell.CssClass = "text-center"; TableRow row = new TableRow (); row.Cells.Add (departCell); row.Cells.Add (arriveCell); TableTimes.Rows.Add (row); } } } }
public static Table BuildASPTable(string xmlTable, Table tblResult) { XmlDocument doc = new XmlDocument(); //Load the the document with the last book node. XmlTextReader reader = new XmlTextReader(@"C:\cgcontrolpanel\site\CGControlPanel\App_Data\Table.xml"); doc.Load(reader); bool firstPass = true; foreach (XmlNode xmlNode in doc.ChildNodes.Item(1).ChildNodes) { if (firstPass) { firstPass = false; var tableHeaderRow = new TableHeaderRow(); foreach (XmlNode xmlCell in xmlNode.ChildNodes) { var tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = xmlCell.InnerText; tableHeaderRow.Cells.Add(tableHeaderCell); } tblResult.Rows.Add(tableHeaderRow); } else { var tableRow = new TableRow(); foreach (XmlNode xmlCell in xmlNode.ChildNodes) { var tableCell = new TableCell(); tableCell.Text = xmlCell.InnerText; tableRow.Cells.Add(tableCell); } tblResult.Rows.Add(tableRow); } } return tblResult; }
private void AddHeaderCell(TableHeaderRow row, string width, string text, string cssClass = "") { using (TableHeaderCell cell = new TableHeaderCell()) { if (!string.IsNullOrWhiteSpace(width)) { cell.Style.Add("width", width); } if (!string.IsNullOrWhiteSpace(cssClass)) { cell.CssClass = cssClass; } using (HtmlGenericControl span = new HtmlGenericControl("span")) { span.InnerText = text; cell.Controls.Add(span); } row.Cells.Add(cell); } }
private void createTableHeader(Table table) { TableRow row = new TableHeaderRow(); TableCell productCell = new TableHeaderCell(); TableCell descriptionCell = new TableHeaderCell(); TableCell quantityCell = new TableHeaderCell(); TableCell priceCell = new TableHeaderCell(); TableCell totalCell = new TableHeaderCell(); productCell.Text = "Produto"; descriptionCell.Text = "Descrição"; quantityCell.Text = "Quantitade"; priceCell.Text = "Preço"; totalCell.Text = "Total"; row.Cells.Add(productCell); row.Cells.Add(descriptionCell); row.Cells.Add(quantityCell); row.Cells.Add(priceCell); row.Cells.Add(totalCell); table.Rows.Add(row); }
protected void CreateTable() { Table1.Rows.Clear(); CurrentDateLabel.Text = "Selected date: " + TextBox2.Text; var courts = CourtDB.GetAllCourts(); TableHeaderRow tbHeaderRow = new TableHeaderRow(); TableHeaderCell tbHeaderTimeCell = new TableHeaderCell(); tbHeaderRow.Cells.Add(tbHeaderTimeCell); for (int i = 0; i < courts.Count; i++) { TableHeaderCell tbHeaderCell = new TableHeaderCell(); tbHeaderCell.Text = courts[i].Name + " " + courts[i].Id; tbHeaderRow.Cells.Add(tbHeaderCell); } Table1.Rows.Add(tbHeaderRow); for (int i = 0; i < SessionItem.OpenTimeSpan.Hours; i++) { DateTime dateTime = DateTime.Parse(TextBox2.Text + " " + (SessionItem.DaySessionStartTime.Hour + i) + ":00:00"); SessionItem sessionItem = new SessionItem(dateTime); TableRow trRow = new TableRow(); TableCell timeCell = new TableCell(); timeCell.Text = sessionItem.SessionTime.ToShortTimeString().TrimEnd(':'); trRow.Cells.Add(timeCell); for (int j = 0; j < courts.Count; j++) { TableCell tableCell = new TableCell(); if (!sessionItem.CourtVacancy[j]) { tableCell.BackColor = Color.FromArgb(255, 0, 127); } else { tableCell.BackColor = Color.FromArgb(153, 255, 153); } trRow.Cells.Add(tableCell); var sessionItemButton = new SessionItemButton(); sessionItemButton.CssClass = "SIButton"; sessionItemButton.BackColor = sessionItem.CourtVacancy[j] ? Color.FromArgb(153,255,153) : Color.FromArgb(255,0,127); sessionItemButton.Visible = sessionItem.CourtVacancy[j]; sessionItemButton.Court = courts[j]; sessionItemButton.StartSessionTime = sessionItem.SessionTime; sessionItemButton.Click += UpdateSelectedSessionItems; UpdatePanel3.Triggers.Add(new AsyncPostBackTrigger(){ControlID = sessionItemButton.ID, EventName = "Click"}); ((IParserAccessor)tableCell).AddParsedSubObject(sessionItemButton); } Table1.Rows.Add(trRow); } }
/// <summary> /// 动态添加子表行和单元格以及单元格内各控件 /// </summary> /// <param name="tab">当前单据子表</param> private void AddSonTableRows(Table tab) { //检测表是否存在 if (tab == null) { return; } //新建子表的表头行 var thr = new TableHeaderRow(); thr.ID = "trHeadRow"; thr.ClientIDMode = ClientIDMode.Static; thr.CssClass = "yd-head-tr"; //表头行各单元格css string[] cssClasses = "rowidtd,prevprocnametd,lotidtd,productnumtd,pnlqtytd,pcsqtytd,remarktd,operatetd".Split(','); //表头行各单元格显示的文字 string[] showTexts = "行号,上部门名称,批量卡号,生产编号,pnl数量,pcs数量,备注,操作".Split(','); //为行添加单元格 for (int i = 0; i < cssClasses.Length; i++) { //新建子表表头单元格 var thc = new TableHeaderCell(); thc.CssClass = cssClasses[i]; thc.Text = showTexts[i]; //添加到表头行 thr.Cells.Add(thc); } //添加表头到表 tab.Rows.Add(thr); //添加子表多个内容行 for (int i = 0; i < 10; i++) { //新建子表内容行 var tr = new TableRow(); tr.ID = "trContentRow" + i; tr.ClientIDMode = ClientIDMode.Static; //当前列号 int j = 0; //新建内容单元格 var tc = new TableCell(); tc.CssClass = "yd-center-td rowidtd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", j.ToString()); //内容行单元格控件 //文字显示控件 var lit = new Literal(); lit.ID = "litRowId" + i; lit.ClientIDMode = ClientIDMode.Static; lit.Text = (i + 1).ToString(); //添加控件到单元格 tc.Controls.Add(lit); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-center-td prevprocnametd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", j.ToString()); //内容行单元格控件 //文字显示控件 var tb = new TextBox(); tb.ID = "txtPrevProcName" + i; tb.ClientIDMode = ClientIDMode.Static; tb.CssClass = "prevprocnametb"; //添加控件到单元格 tc.Controls.Add(tb); //添加单元格到行 tr.Cells.Add(tc); //验证控件 var cv = new CustomValidator(); cv.ID = "cvPrevProcName" + i; ; cv.ErrorMessage = "*"; cv.CssClass = "yd-validator"; cv.SetFocusOnError = true; cv.Display = ValidatorDisplay.Dynamic; cv.ToolTip = "上部门名称不正确"; cv.ControlToValidate = "txtPrevProcName" + i; cv.ServerValidate += cvPrevProcName_ServerValidate; //添加控件到单元格 tc.Controls.Add(cv); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-left-td lotidtd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", (++j).ToString()); //内容行单元格控件 //文本框 tb = new TextBox(); tb.ID = "txtLotId" + i; tb.ClientIDMode = ClientIDMode.Static; tb.CssClass = "lotidtb"; //添加控件到单元格 tc.Controls.Add(tb); //验证控件 var rev = new RegularExpressionValidator(); rev.ID = "revLotId" + i; rev.ErrorMessage = "*"; rev.CssClass = "yd-validator"; rev.SetFocusOnError = true; rev.Display = ValidatorDisplay.Dynamic; rev.ToolTip = "必须为两位年份两位月份-最多5位整数,样板要在-后面添加S"; rev.ControlToValidate = "txtLotId" + i; rev.ValidationExpression = @"^[1-9]\d(0[1-9]|1[012])-S?[1-9]\d{0,4}$"; //添加控件到单元格 tc.Controls.Add(rev); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-left-td productnumtd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", (++j).ToString()); //内容行单元格控件 //文本框 tb = new TextBox(); tb.ID = "txtProductNum" + i; tb.ClientIDMode = ClientIDMode.Static; tb.CssClass = "productnumtb"; //添加控件到单元格 tc.Controls.Add(tb); //验证控件 cv = new CustomValidator(); cv.ID = "revProductNum" + i; ; cv.ErrorMessage = "*"; cv.CssClass = "yd-validator"; cv.SetFocusOnError = true; cv.Display = ValidatorDisplay.Dynamic; cv.ToolTip = "只允许版本号与订单生产编号不相同"; cv.ControlToValidate = "txtProductNum" + i; cv.ServerValidate += cvProductNum_ServerValidate; //添加控件到单元格 tc.Controls.Add(cv); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-right-td pnlqtytd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", (++j).ToString()); //内容行单元格控件 //文本框 tb = new TextBox(); tb.ID = "txtPnlQty" + i; tb.ClientIDMode = ClientIDMode.Static; tb.CssClass = "pnlqtytb"; //添加控件到单元格 tc.Controls.Add(tb); //验证控件 rev = new RegularExpressionValidator(); rev.ID = "revPnlQty" + i; ; rev.ErrorMessage = "*"; rev.CssClass = "yd-validator"; rev.SetFocusOnError = true; rev.Display = ValidatorDisplay.Dynamic; rev.ToolTip = "必须为大于0的纯数字或为空"; rev.ControlToValidate = "txtPnlQty" + i; rev.ValidationExpression = @"^[1-9]\d*$"; //添加控件到单元格 tc.Controls.Add(rev); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-right-td pcsqtytd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", (++j).ToString()); //内容行单元格控件 //文本框 tb = new TextBox(); tb.ID = "txtPcsQty" + i; tb.ClientIDMode = ClientIDMode.Static; tb.CssClass = "pcsqtytb"; //添加控件到单元格 tc.Controls.Add(tb); //验证控件 rev = new RegularExpressionValidator(); rev.ID = "revPcsQty" + i; ; rev.ErrorMessage = "*"; rev.CssClass = "yd-validator"; rev.SetFocusOnError = true; rev.Display = ValidatorDisplay.Dynamic; rev.ToolTip = "必须为大于0的纯数字或为空"; rev.ControlToValidate = "txtPcsQty" + i; rev.ValidationExpression = @"^[1-9]\d*$"; //添加控件到单元格 tc.Controls.Add(rev); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-left-td remarktd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", (++j).ToString()); //内容行单元格控件 //文本框 tb = new TextBox(); tb.ID = "txtRemark" + i; tb.ClientIDMode = ClientIDMode.Static; tb.CssClass = "remarktb"; //添加控件到单元格 tc.Controls.Add(tb); //添加单元格到行 tr.Cells.Add(tc); //新建内容单元格 tc = new TableCell(); tc.CssClass = "yd-center-td operatetd"; tc.Attributes.Add("data-yd-row-index", i.ToString()); tc.Attributes.Add("data-yd-col-index", (++j).ToString()); //内容行单元格控件 //图片 var img = new Image(); img.ID = "imgClear" + i; img.ClientIDMode = ClientIDMode.Static; img.CssClass = "yd-img-clear"; img.ToolTip = "清空本行"; img.ImageUrl = "~/Images/Shared/delete.png"; //添加控件到单元格 tc.Controls.Add(img); //添加单元格到行 tr.Cells.Add(tc); //添加行到表 tab.Rows.Add(tr); } }
private void BuildEmailsTable() { TableHeaderCell hCell = null; TableHeaderRow hRow = null; this.emailsTable.Rows.Clear(); hRow = new TableHeaderRow(); hRow.CssClass = "TableHeaderRow"; hCell = new TableHeaderCell(); hCell.Text = "Id"; hCell.CssClass = "EmailIdHeader"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); hCell = new TableHeaderCell(); hCell.Text = "Description"; hCell.CssClass = "EmailDescriptionHeader"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); hCell = new TableHeaderCell(); hCell.Text = "Offset(dd:hh)"; hCell.CssClass = "EmailOffsetHeader"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); hCell = new TableHeaderCell(); hCell.Text = "Status"; hCell.CssClass = "EmailStatusHeader"; hCell.CssClass = "EditorTableHeaders"; hRow.Cells.Add(hCell); this.emailsTable.Rows.Add(hRow); this.emailsCountLabel.Text = "Campaign Emails Found: 0"; this.emailsTable.Attributes.Add("class", "sortable EditorTables"); }
private void createTable() { //Create table headers TableHeaderRow headerRow = new TableHeaderRow(); TableHeaderCell IDHead = new TableHeaderCell(); Label IDHeadLabel = new Label(); IDHeadLabel.Text = "ID"; IDHead.Controls.Add(IDHeadLabel); TableHeaderCell pageHead = new TableHeaderCell(); Label pageHeadLabel = new Label(); pageHeadLabel.Text = "Page"; pageHead.Controls.Add(pageHeadLabel); TableHeaderCell descHead = new TableHeaderCell(); Label descHeadLabel = new Label(); descHeadLabel.Text = "Description"; descHead.Controls.Add(descHeadLabel); TableHeaderCell activeHead = new TableHeaderCell(); Label activeHeadLabel = new Label(); activeHeadLabel.Text = "Active"; activeHead.Controls.Add(activeHeadLabel); TableHeaderCell editHead = new TableHeaderCell(); Label editHeadLabel = new Label(); editHeadLabel.Text = "Edit"; editHead.Controls.Add(editHeadLabel); headerRow.Controls.Add(IDHead); headerRow.Controls.Add(pageHead); headerRow.Controls.Add(descHead); headerRow.Controls.Add(activeHead); headerRow.Controls.Add(editHead); descTable.Controls.Add(headerRow); var reader = DbConn.dBRead("EXEC GetDescriptions"); while (reader.Read()) { TableRow row = new TableRow(); TableCell IDCell = new TableCell(); Label IDLabel = new Label(); IDLabel.Text = "" + reader["ID"]; TableCell pageCell = new TableCell(); Label pageLabel = new Label(); pageLabel.Text = "" + reader["Page"]; TableCell descCell = new TableCell(); Label descLabel = new Label(); descLabel.Text = "" + reader["Description"]; TableCell activeCell = new TableCell(); Label activeLabel = new Label(); activeLabel.Text = "" + reader["Active"]; Button button = new Button(); button.ID = Convert.ToString(reader["ID"]); button.Text = "Edit"; button.Click += new EventHandler(editCellMethod); TableCell buttonCell = new TableCell(); buttonCell.Controls.Add(button); IDCell.Controls.Add(IDLabel); pageCell.Controls.Add(pageLabel); descCell.Controls.Add(descLabel); activeCell.Controls.Add(activeLabel); row.Controls.Add(IDCell); row.Controls.Add(pageCell); row.Controls.Add(descCell); row.Controls.Add(activeCell); row.Cells.Add(buttonCell); descTable.Controls.Add(row); } }
/// <summary> /// Creates a table for each transaction and displays them on the page. /// </summary> private void showTransactions() { transactions = transactions.OrderByDescending(x => x.timestamp).ToList(); string[] transheaders = { "Date", "Company", "Shares", "Price", "Fees", "Type" }; string[] transwidths = { "20%", "16%", "16%", "16%", "16%", "16%" }; int transcolumns = 6; PortfolioDiv.Controls.Clear(); Table htbl = new Table(); TableHeaderRow hr = new TableHeaderRow(); for (int i = 0; i < transcolumns; i++) { TableHeaderCell cell = new TableHeaderCell(); cell.Text = transheaders[i]; cell.Width = new Unit(transwidths[i]); hr.Cells.Add(cell); } htbl.Rows.Add(hr); PortfolioDiv.Controls.Add(htbl); foreach (Trade t in transactions) { Table tbl = new Table(); TableRow tr = new TableRow(); for (int i = 0; i < transcolumns; i++) { TableCell cell = new TableCell(); cell.Width = new Unit(transwidths[i]); tr.Cells.Add(cell); } tr.Cells[0].Text = t.timestamp.ToString(); tr.Cells[1].Text = t.SymbolName; tr.Cells[2].Text = t.InitialQuantity.ToString(); tr.Cells[3].Text = String.Format("{0:C}", t.price); tr.Cells[4].Text = String.Format("{0:C}", t.PaidCommission); tr.Cells[5].Text = t.type.ToString(); tbl.Rows.Add(tr); tbl.CssClass = "main"; PortfolioDiv.Controls.Add(tbl); } }
/// <summary> /// Creates a table for all of the Trades associated with a specific Position. /// </summary> /// <param name="pm">PositionMessage</param> /// <returns>Table</returns> private Table createTradeTable(PositionMessage pm) { string[] theaders = { "", "Date", "Shares", "Price / Gain / Gain %", "Fees", "Type", "" }; Table tbl = new Table(); TableHeaderRow header = new TableHeaderRow(); for (int i = 0; i < tcolumns; i++) { TableHeaderCell cell = new TableHeaderCell(); cell.Text = theaders[i]; cell.Width = new Unit(widths[i]); header.Cells.Add(cell); } tbl.Rows.Add(header); TraderContext db = new TraderContext(); double latestQuote = db.Quotes.Where(x => x.SymbolName.Equals(pm.SymbolName)).OrderByDescending(x => x.timestamp).Select(x => x.price).FirstOrDefault(); foreach (TradeMessage t in pm.Trades.OrderByDescending(x => x.Timestamp).Where((x) => x.Quantity > 0 && x.Type==Portfolio.Client.tradeTypes.Buy)) { double gain = 0; double gainPercent = 0; string classname = string.Empty; TableRow trow = new TableRow(); for (int i = 0; i < tcolumns; i++) { TableCell cell = new TableCell(); trow.Cells.Add(cell); } gain = latestQuote - t.Price; gainPercent = gain / t.Price; if (gain > 0) { classname = "green"; } if (gain < 0) { classname = "red"; } trow.Cells[1].Text = String.Format("{0:d} at {0:T}", t.Timestamp); // symbol name trow.Cells[1].Text += new HtmlString(String.Format(" <span class='subtext'>({0})</span>", getTimeSpan(t.Timestamp))); // date trow.Cells[2].Text = String.Format("{0:N0}", t.Quantity); // quantity trow.Cells[3].Text = new HtmlString(String.Format("{0:C} / <span class='{3}'>{1:C}</span> / <span class='{3}'>{2:P2}</span>", t.Price, gain, gainPercent, classname)).ToString(); trow.Cells[4].Text = String.Format("{0:C}", t.PaidCommission); // broker fee trow.Cells[5].Text = t.Type.ToString(); trow.Cells[5].CssClass = getCssClass(t.Type.ToString()); tbl.Rows.Add(trow); } // css stuff tbl.CssClass = "sub"; return tbl; }
protected Table createMouleTable(int iRow) { clsAuthorizationDetails objAutho = new clsAuthorizationDetails(); List <EntModuleDetails> lst = objAutho.getModuleList(); Session[clsConstant.SESS_MODULE] = lst; tblModule = new Table(); tblModule.CellPadding = 2; tblModule.CellSpacing = 2; tblModHrRow = new TableHeaderRow(); tblModRow = new TableRow(); for (int iloop = 0; iloop < lst.Count; iloop++) { tblModHrCell = new TableHeaderCell(); lblHeading = new Label(); lblHeading.Text = Server.HtmlEncode(lst[iloop].ModuleName); lblHeading.ID = "lblHeading" + iRow + "_" + iloop; lblHeading.Font.Bold = true; tblModHrCell.Controls.Add(lblHeading); tblModHrRow.Controls.Add(tblModHrCell); tblModCell = new TableCell(); chkbox = new CheckBox(); chkbox.Text = "View"; chkbox.ID = "chkView" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); if (lst[iloop].ModuleID == clsConstant.NOMIATION_ID) { chkbox = new CheckBox(); chkbox.Text = "Upload"; chkbox.ID = "chkUpload" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); chkbox = new CheckBox(); chkbox.Text = "Short List"; chkbox.ID = "chkShortList" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); chkbox = new CheckBox(); chkbox.Text = "Approve"; chkbox.ID = "chkApprove" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); } else { chkbox = new CheckBox(); chkbox.Text = "Edit"; chkbox.ID = "chkEdit" + iRow + "_" + lst[iloop].ModuleID; tblModCell.Controls.Add(chkbox); } tblModRow.Controls.Add(tblModCell); } tblModule.Controls.Add(tblModHrRow); tblModule.Controls.Add(tblModRow); return(tblModule); }