asp.net - RowSpan and alternate row color at the same time using c# -
I am trying to use line duration on 1 column (if the value of the next line is the same) and optional Color row above position
The way I wanted I am working, but can not alternate the rows Batch Nano: line 3694217 should also be blue.
Here's the current output:
ASP
and ATP: gridview id = "visualization" runat = "server" autostart column columns = "ftl" ondata = "OnDataBound" OnItemDataBound = "Item_Bound" cellpadding = "15" cell spacing = "15" header style-backlar = "dark olive green" gridline = "both" & gt; & Lt; Columns & gt; & Lt; ASP: BoundfieldDefined = "Batcho" header text = "batch no" header style-width = "15%" /> & Lt; ASP: Boundfield Dated Field = "Type" Header Text = "Type" Header Style-width = "15%" /> & Lt; Asp: ImageField DataImageUrlField = "Dataloaded" header text = "dataloaded" header style-width = "15%" /> & Lt; Asp: ImageField DataImageUrlField = "Errors" header text = "Errors" header style-width = "15%" /> & Lt; Asp: ImageField DataImageUrlField = "ProcessingRun" HeaderTax = "Processing" header style-width = "15%" /> & Lt; / Column & gt; & Lt; / ASP: GridView & gt; C #
Protected Zero Page_load (Object Sender, EventArgges E) {dataT (); Visualisation.DataBind (); } Public Zero Data T () {Datatale dtVisu = New Datatile (); DtVisu.Columns.Add (New DataColumn ("Batch NoNo", System.String)); DtVisu.Columns.Add (New DataColumn ("Type", System.String)); DtVisu.Columns.Add (New DataColumn ("DataLoaded", typeof (System.String)); DtVisu.Columns.Add (New DataColumn ("Errors", System.String)); DtVisu.Columns.Add (New DataColumn ("ProcessingRun", System.String)); //dtVisu.Column.Add (new data columns ("alignrow", typeof (System.String)); Datarov Dr. = DTV. NewRow (); Dr. ["Batcho"] = "3704500"; Dr. ["type"] = "calibration"; Dr. ["Dataloaded"] = "Picture / g4-12.png"; Dr. ["Errors"] = "Picture / G4-12.png"; Dr. ["Processing"] = "Picture / G4-12.png"; // DR ["alignRow"] = "1"; DtVisu.Rows.Add (Dr.); Dr = dtVisu.NewRow (); Dr. ["Batchano"] = "3704542"; Dr. ["type"] = "range setting"; Dr. ["Dataloaded"] = "Picture / r4-12.png"; Dr. ["Errors"] = "Picture / r4-12.png"; Dr. ["Processing"] = "Picture / G4-12.png"; DtVisu.Rows.Add (Dr.); Dr = dtVisu.NewRow (); Dr. ["Batchano"] = "3704542"; Dr. ["type"] = "range setting"; Dr. ["Dataloaded"] = "Picture / r4-12.png"; Dr. ["Errors"] = "Picture / r4-12.png"; Dr. ["Processing"] = "Picture / G4-12.png"; DtVisu.Rows.Add (Dr.); Dr = dtVisu.NewRow (); Dr. ["Batcho"] = "3687345"; Dr. ["type"] = "calibration"; Dr. ["Dataloaded"] = "Picture / g4-12.png"; Dr. ["Errors"] = "Picture / G4-12.png"; Dr. ["Processing"] = "Picture / G4-12.png"; DtVisu.Rows.Add (Dr.); Dr = dtVisu.NewRow (); Dr. ["Batchano"] = "36 9 4,217"; Dr. ["type"] = "calibration"; Dr. ["Dataloaded"] = "Picture / g4-12.png"; Dr. ["Errors"] = "Picture / G4-12.png"; Dr. ["Processing"] = "Picture / G4-12.png"; DtVisu.Rows.Add (Dr.); Visualization.datasource = dtVisu; } Protected Zero OnDataBound (Object Sender, EventArgs e) {int RowSpan = 2; For (int i = visualization.rows.Count - 2; i> = 0; i--) {GridViewRow currRow = Visualization. Rao [i]; GridViewRow prevRow = Visualization. Rao [i + 1]; If (currRow.Cells [0]. Text == preceding seals [0]. Text) {currRow.Cells [0] .rowSpan = RowSpan; Prevrow.Cells [0] .Visible = false; Rospan + = 1; CurrRow.BackColor = Color.FromName ("# 7AA5D6"); Prevrow.BackColor = Color.FromName ("# 7AA5D6"); } And {Roshna = 2; }}}}
To provide you with an alternate line, a separate counter of your rows Need to keep Note that if only rows are expanded in the existing code color, then alternatively a single line is not halgled. Some should move around it:
Protected Zero OnDataBound (Object Sender, EventArgs e) {int RowSpan = 2; // Actual row counter, spanning rows an int rowCount = 0; For (int i = visualization.rows.Count - 2; i> = 0; i--) {GridViewRow currRow = Visualization. Rao [i]; GridViewRow prevRow = Visualization. Rao [i + 1]; If (currRow.Cells [0]. Text == preceding seals [0]. Text) {currRow.Cells [0] .rowSpan = RowSpan; Prevrow.Cells [0] .Visible = false; Rospan + = 1; } And {Roshna = 2; // This was a new row line; ++; } If (puncto counts% 2 == 0) {currRow.BackColor = Color.FromName ("# 7AA5D6"); }}}
Comments
Post a Comment