Monday 27 October 2014

Grid Decoration By Row Created

 Protected Sub grdData_created(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdData.RowCreated
        e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
        e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
        e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
        e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
        e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left
        e.Row.Cells(1).VerticalAlign = VerticalAlign.Top
        If (e.Row.RowType = DataControlRowType.Header) Then
            ' e.Row.ForeColor = System.Drawing.Color.Black
        Else
            e.Row.Cells(2).ForeColor = Drawing.Color.DarkBlue
            e.Row.Cells(3).ForeColor = Drawing.Color.DarkCyan
            e.Row.Cells(4).ForeColor = Drawing.Color.DarkViolet
            e.Row.Cells(7).ForeColor = Drawing.Color.DarkGreen
        End If
    End Sub