private void @__BuildControl__control12(System.Web.UI.WebControls.TableCellCollection @__ctrl) { global::System.Web.UI.WebControls.TableCell @__ctrl1; @__ctrl1 = this.@__BuildControl__control13(); @__ctrl.Add(@__ctrl1); global::System.Web.UI.WebControls.TableCell @__ctrl2; @__ctrl2 = this.@__BuildControl__control14(); @__ctrl.Add(@__ctrl2); }
private static void RemoveBottomBorder(TableCellCollection cells, int count) { if (count > cells.Count) return; for (var index = 0; index < count; ++index) { var gridViewTableCellEx = cells[index] as GridViewTableCellEx; if (gridViewTableCellEx != null) gridViewTableCellEx._RemoveBottomBorder(true); } }
protected virtual ListViewItemCollection CreateListViewItemCollection(TableCellCollection cells, ListViewItem headerItem, ListViewItem footerItem) { return new ListViewItemCollection(cells, headerItem, footerItem); }
void ApplyColumnStyle (TableCellCollection cells, ListItemType type) { int ncells = Math.Min (cells.Count, render_columns.Length); if (ncells <= 0) return; for (int i = 0; i < ncells; i++) { Style style = null; TableCell cell = cells [i]; DataGridColumn column = render_columns [i]; if (!column.Visible) { cell.Visible = false; continue; } style = column.GetStyle (type); if (style != null) cell.MergeStyle (style); } }
/// <summary> /// Method that HTML Encodes an entire DataGrid. /// It iterates through each cell in the TableRow, ensuring that all /// the text being displayed is HTML Encoded, irrespective of whether /// they are just plain text, buttons, hyperlinks, multiple controls etc.. /// <seealso cref="System.Web.UI.WebControls.DataGrid.ItemDataBound">DataGrid.ItemDataBound Event</seealso> /// </summary> /// <param name="item"> /// The DataGridItem that is currently being bound in the calling Web /// Page's DataGrid.ItemDataBound Event. /// </param> /// <remarks> /// This method should be called from the /// <c>DataGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)</c> /// event in the respective Web View Codebehind. /// </remarks> /// <example> /// We want to HTMLEncode a complete DataGrid (all columns and all /// rows that may/do contain characters that will require encoding /// for display in HTML) called dgIssues. /// Use the following code for the ItemDataBound Event: /// <code> /// private void dgIssues_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) /// { /// WebMethod wm = new WebMethod(); /// wm.DataGrid_ItemDataBound_HTMLEncode((DataGridItem) e.Item); /// }//dgIssues_ItemDataBound /// </code> /// </example> public void AdHocHTMLEncode(System.Web.UI.WebControls.DataGridItem item) { bool doHTMLEncode = false; switch (item.ItemType) { #region DataBound //The following case statements are in ascending TableItemStyle order. //See ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclassitemstyletopic.htm for details. case System.Web.UI.WebControls.ListItemType.Item: { doHTMLEncode = true; break; } //ListItemType.Item case System.Web.UI.WebControls.ListItemType.AlternatingItem: { doHTMLEncode = true; break; } //ListItemType.AlternatingItem case System.Web.UI.WebControls.ListItemType.SelectedItem: { doHTMLEncode = true; break; } //ListItemType.SelectedItem case System.Web.UI.WebControls.ListItemType.EditItem: { //These should not be prone to this as TextBoxes aren't. doHTMLEncode = false; break; } //ListItemType.EditItem #endregion DataBound #region Non-DataBound //The remainder are the other ListItemTypes that are non-Data-bound. case System.Web.UI.WebControls.ListItemType.Header: { //We might have specified Headers like "<ID>". doHTMLEncode = true; break; } //ListItemType.Header case System.Web.UI.WebControls.ListItemType.Footer: { //Similarly for the Footer as with the Header. doHTMLEncode = true; break; } //ListItemType.Footer case System.Web.UI.WebControls.ListItemType.Pager: { //With just numbers or buttons, none is required. //However, for buttons, this is not strictly true as you //need to specify the text on the buttons. But the Property //Builder for the DataGrid hints in its defaults that these //need to be HTMLencoded anyway. doHTMLEncode = false; break; } //ListItemType.Pager case System.Web.UI.WebControls.ListItemType.Separator: { doHTMLEncode = false; break; } //ListItemType.Separator #endregion Non-DataBound default: { //This will never be executed as all ItemTypes are listed above. break; } //default } //switch if (doHTMLEncode) { //Encode the cells dependent on the type of content //within (e.g. BoundColumn, Hyperlink), taking into account //that there may be more than one (or even zero) control in //each cell. System.Web.UI.WebControls.TableCellCollection cells = (System.Web.UI.WebControls.TableCellCollection)item.Cells; foreach (System.Web.UI.WebControls.TableCell cell in cells) { if (cell.Controls.Count != 0) { foreach (System.Web.UI.Control ctrl in cell.Controls) { if (ctrl is Button) { Button btn = (Button)ctrl; btn.Text = HttpUtility.HtmlEncode(btn.Text); } //if else if (ctrl is HyperLink) { HyperLink hyp = (HyperLink)ctrl; hyp.Text = HttpUtility.HtmlEncode(hyp.Text); //hyp.NavigateUrl = HttpUtility.UrlEncode(hyp.NavigateUrl); } //else if else if (ctrl is LinkButton) { LinkButton lb = (LinkButton)ctrl; lb.Text = HttpUtility.HtmlEncode(lb.Text); } //else if // this check is for to change the forecolor of REJECTED activities to red else if (ctrl is Label) { Label objL = (Label)ctrl; if (objL.Text == "REJECTED") { objL.ForeColor = System.Drawing.Color.Red; } } //else if } //foreach } //if else { //The cell is a BoundColumn. if (cell.Text.ToLower().Trim() != " ") { cell.Text = HttpUtility.HtmlEncode(cell.Text); } } //else } //foreach } //if } //DataGrid_ItemDataBound_HTMLEncode
internal ListViewItemCollection(TableCellCollection itemCellCollection, ListViewItem headerItem, ListViewItem footerItem) { _itemCellCollection = itemCellCollection; _headerItem = headerItem; _footerItem = footerItem; }
private Decimal GetTotalProposed(TableCellCollection cells) { Decimal total = 0.0m; for (int i = 1; i < cells.Count; i++) { total += Convert.ToDecimal(cells[i].Text.Substring(1)); } return total; }
private Decimal GetProjectedTotals(TableCellCollection cells, string TotalType) { int i = 1; Decimal total = 0.0m; if (TotalType == "RSS"){ i++;} total += Convert.ToDecimal(cells[i].Text.Substring(1)); total += Convert.ToDecimal(cells[i+2].Text.Substring(1)) * .1m; total += Convert.ToDecimal(cells[i+4].Text.Substring(1)) * .5m; total += Convert.ToDecimal(cells[i+6].Text.Substring(1)) * .9m; return total; }
private void AddForecastRow(TableCellCollection cells) { TableRow monthForecast = new TableRow(); TableCell cell = new TableCell(); cell.Text = cells[0].Text; cell.CssClass = "Top25RowHeader"; cell.HorizontalAlign = HorizontalAlign.Right; monthForecast.Cells.Add(cell); cell = new TableCell(); cell.Text = this.GetProjectedTotals(cells, "RMR").ToString("C"); cell.HorizontalAlign = HorizontalAlign.Right; monthForecast.Cells.Add(cell); cell = new TableCell(); cell.Text = this.GetProjectedTotals(cells, "RSS").ToString("C"); cell.HorizontalAlign = HorizontalAlign.Right; monthForecast.Cells.Add(cell); cell = new TableCell(); cell.Text = this.GetTotalProposed(cells).ToString("C"); cell.HorizontalAlign = HorizontalAlign.Right; monthForecast.Cells.Add(cell); if(tblForecastSummary.Rows.Count %2 == 0) { monthForecast.CssClass = "Top25AlternateData"; } else { monthForecast.CssClass = "Top25Data"; } tblForecastSummary.Rows.Add(monthForecast); }
private void AddForecastRow(TableCellCollection cells) { TableRow monthForecast = new TableRow(); TableCell cell = new TableCell(); cell.Text = cells[0].Text; monthForecast.Cells.Add(cell); cell = new TableCell(); cell.Text = this.GetProjectedTotals(cells, "RMR").ToString("C"); monthForecast.Cells.Add(cell); cell = new TableCell(); cell.Text = this.GetProjectedTotals(cells, "RSS").ToString("C"); monthForecast.Cells.Add(cell); cell = new TableCell(); cell.Text = this.GetTotalProposed(cells).ToString("C"); monthForecast.Cells.Add(cell); tblForecastSummary.Rows.Add(monthForecast); }
private Decimal GetTotalProposed(TableCellCollection cells, string TotalType) { int i = 1; Decimal total = 0.0m; if (TotalType == "RSS"){ i++;} for (; i <= summaryTotal.Length; i++) { total += Convert.ToDecimal(cells[i++].Text.Substring(1)); } return total; }