1

SQLサーバーからの結果を表示していGridViewます。すべての値は前の値に従う必要があります。たとえば、3373は3372の前でなければなりません。値が前の値に従わないとすぐに、グリッドビューの行に色を付ける必要があります。値が欠落している場合があるため、値が欠落しているかどうかを特定する必要があります。

4

1 に答える 1

1

OnRowDataBound イベントを使用して、最後の値を保存して比較できます。このようなもの:

Private _lastRowValue As Integer =  -1 

Protected  Sub OnGridViewRowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) 
    If e.Row.RowType = DataControlRowType.DataRow Then
      If _lastRowValue <> -1 Then
          ' read current row value, compare and then format, e.g. like this 
          e.Row.Cells(1).Text = "<i>" + e.Row.Cells(1).Text + "</i>"
      End If
      _lastRowValue = ... ' read value from cell 
    End If
End Sub
于 2012-08-30T11:02:26.810 に答える