EDN Admin
Well-known member
I am trying to find a way to sort my data by the finaltotal but I need to display the data at one time using a <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small asp<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small :<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small Table<span style="font-size:small
<span style="color:#ff0000; font-size:small <span style="color:#ff0000; font-size:small ID<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small ="TableWeek"<span style="font-size:small
<span style="color:#ff0000; font-size:small <span style="color:#ff0000; font-size:small runat<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small ="server"<span style="font-size:small
<span style="color:#ff0000; font-size:small <span style="color:#ff0000; font-size:small HorizontalAlign<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small ="Right
Do I need to set the data in a dataview sort then display?
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
For
<span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Each<span style="font-size:small dt
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small DataTable
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small In<span style="font-size:small ds.Tables
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small dr
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small DataRow = dt.Rows(0)
<span style="font-size:small
tr =
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small New<span style="font-size:small TableRow
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small lowscore
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 99999
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small lowscorecolumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 0
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small currentcolumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 0
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small index
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 0
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small Dim data As New System.Collections.ArrayList
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small
<br/>
<span style="font-size:small
finaltotal = 0
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small For<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Each<span style="font-size:small column
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small DataColumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small In<span style="font-size:small dt.Columns
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small score
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32
<span style="font-size:small
Int32.TryParse(dr(column.ColumnName).ToString, score)
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If<span style="font-size:small currentcolumn > 0
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Then
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If<span style="font-size:small score < lowscore
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Then
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
lowscore = score
lowscorecolumn = currentcolumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small End<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small End<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<br/>
<span style="font-size:small
finaltotal += score
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small finaltotal = finaltotal + dr("total")
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small loop thru the columns and add up the scores - throwing out the low score(s) if you want
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small then create a table cell for display something like this (see currentrosters.aspx in the football project for an example):
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td =
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small New<span style="font-size:small TableCell
<span style="font-size:small
td.CssClass =
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "medium"
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small td.Text = finaltotal
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td.Text = dr(column.ColumnName).ToString
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If<span style="font-size:small currentcolumn = 0
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Then
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
td.HorizontalAlign = HorizontalAlign.Left
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Else
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
td.HorizontalAlign = HorizontalAlign.Right
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small End<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small td.RowSpan = "2"
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td.Attributes.Add(
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "style"<span style="font-size:small ,
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "padding-right:10px;border-bottom:solid 1px #000066;"<span style="font-size:small )
<span style="font-size:small
tr.Cells.Add(td)
currentcolumn += 1
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Next
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
finaltotal -= lowscore
tr.Cells(lowscorecolumn).BackColor = Drawing.Color.AliceBlue
td =
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small New<span style="font-size:small TableCell
<span style="font-size:small
td.CssClass =
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "medium"
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small
<br/>
<span style="font-size:small
td.Text = finaltotal
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small td.ColumnSpan = "10"
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td.HorizontalAlign = HorizontalAlign.Right
tr.Cells.Add(td)
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small Me.tblWeek.Text = finaltotal
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small data.Add(tr.finaltotal, tr)
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small index += 1
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small Me.tblWeek.Rows.Add(tr)
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Me<span style="font-size:small .TableWeek.Rows.Add(tr)
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Next
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
View the full article
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small asp<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small :<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small Table<span style="font-size:small
<span style="color:#ff0000; font-size:small <span style="color:#ff0000; font-size:small ID<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small ="TableWeek"<span style="font-size:small
<span style="color:#ff0000; font-size:small <span style="color:#ff0000; font-size:small runat<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small ="server"<span style="font-size:small
<span style="color:#ff0000; font-size:small <span style="color:#ff0000; font-size:small HorizontalAlign<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small ="Right
Do I need to set the data in a dataview sort then display?
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
For
<span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Each<span style="font-size:small dt
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small DataTable
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small In<span style="font-size:small ds.Tables
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small dr
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small DataRow = dt.Rows(0)
<span style="font-size:small
tr =
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small New<span style="font-size:small TableRow
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small lowscore
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 99999
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small lowscorecolumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 0
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small currentcolumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 0
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small index
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32 = 0
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small Dim data As New System.Collections.ArrayList
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small
<br/>
<span style="font-size:small
finaltotal = 0
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small For<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Each<span style="font-size:small column
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small DataColumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small In<span style="font-size:small dt.Columns
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Dim<span style="font-size:small score
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small As<span style="font-size:small Int32
<span style="font-size:small
Int32.TryParse(dr(column.ColumnName).ToString, score)
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If<span style="font-size:small currentcolumn > 0
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Then
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If<span style="font-size:small score < lowscore
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Then
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
lowscore = score
lowscorecolumn = currentcolumn
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small End<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small End<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<br/>
<span style="font-size:small
finaltotal += score
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small finaltotal = finaltotal + dr("total")
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small loop thru the columns and add up the scores - throwing out the low score(s) if you want
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small then create a table cell for display something like this (see currentrosters.aspx in the football project for an example):
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td =
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small New<span style="font-size:small TableCell
<span style="font-size:small
td.CssClass =
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "medium"
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small td.Text = finaltotal
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td.Text = dr(column.ColumnName).ToString
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If<span style="font-size:small currentcolumn = 0
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Then
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
td.HorizontalAlign = HorizontalAlign.Left
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Else
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
td.HorizontalAlign = HorizontalAlign.Right
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small End<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small If
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small td.RowSpan = "2"
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td.Attributes.Add(
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "style"<span style="font-size:small ,
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "padding-right:10px;border-bottom:solid 1px #000066;"<span style="font-size:small )
<span style="font-size:small
tr.Cells.Add(td)
currentcolumn += 1
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Next
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <br/>
<span style="font-size:small
finaltotal -= lowscore
tr.Cells(lowscorecolumn).BackColor = Drawing.Color.AliceBlue
td =
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small New<span style="font-size:small TableCell
<span style="font-size:small
td.CssClass =
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "medium"
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small
<br/>
<span style="font-size:small
td.Text = finaltotal
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small td.ColumnSpan = "10"
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
td.HorizontalAlign = HorizontalAlign.Right
tr.Cells.Add(td)
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small Me.tblWeek.Text = finaltotal
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small data.Add(tr.finaltotal, tr)
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small index += 1
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<br/>
<span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small Me.tblWeek.Rows.Add(tr)
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Me<span style="font-size:small .TableWeek.Rows.Add(tr)
<span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small Next
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
View the full article