Hello,
I'm trying to create a datagrid which has a different color for the row when the group breaks. In the second column of the datagrid I'm inserting a '-1' to flag me that is the row that needs to have a different color. Here is a sample of my grid
Document Message Type Message
000000 INFO DROP SHIP ORDER OPENED FOR ORDER NUMBER 2720
000000 INFO DROP SHIP ORDER OPENED FOR ORDER NUMBER 4615
000000 -1
010038 INFO D/S ORDER CANCELED FOR ORDER NUMBER 5724
010038 INFO DROP SHIP ORDER OPENED FOR ORDER NUMBER 5724
I want the rows with '-1' in the second column to be blue. Here is my code so far
Private Sub BindData(ByVal sortExpr As String)
Dim connStr As String = "ConnectionString"
Dim myConnection As New SqlConnection(connStr)
Dim strSQL As String = "SQL Statement"
Dim myCommand As New SqlCommand(strSQL, myConnection)
myConnection.Open()
dgOrders.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
dgOrders.DataBind()
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData("EOFDOC"
End If
End Sub
Sub SortData(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
BindData(e.SortExpression)
End Sub
Please help, Thanks!
I'm trying to create a datagrid which has a different color for the row when the group breaks. In the second column of the datagrid I'm inserting a '-1' to flag me that is the row that needs to have a different color. Here is a sample of my grid
Document Message Type Message
000000 INFO DROP SHIP ORDER OPENED FOR ORDER NUMBER 2720
000000 INFO DROP SHIP ORDER OPENED FOR ORDER NUMBER 4615
000000 -1
010038 INFO D/S ORDER CANCELED FOR ORDER NUMBER 5724
010038 INFO DROP SHIP ORDER OPENED FOR ORDER NUMBER 5724
I want the rows with '-1' in the second column to be blue. Here is my code so far
Private Sub BindData(ByVal sortExpr As String)
Dim connStr As String = "ConnectionString"
Dim myConnection As New SqlConnection(connStr)
Dim strSQL As String = "SQL Statement"
Dim myCommand As New SqlCommand(strSQL, myConnection)
myConnection.Open()
dgOrders.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
dgOrders.DataBind()
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData("EOFDOC"
End If
End Sub
Sub SortData(ByVal sender As Object, ByVal e As DataGridSortCommandEventArgs)
BindData(e.SortExpression)
End Sub
Please help, Thanks!