just go into rowdatabound event of the gridview and there check if row index > 50 the set the style row(index).rowc olor = "red"
this is only a logic, please do the needfull
thanks
I think what he meant is if it's over 50, to add color to any index greater than 50....
In your RowDataBound event keep track of how many rows have been added:
[code=vbnet]
Private numRows As Integer = 0
'....
Protected Sub MyGridView_RowD ataBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles MyGridView.RowD ataBound
numRows+=1
If numRows>50
For i As Integer=0 to e.Row.Cells.Cou nt -1
e.Row.Cells(i). Style.Add("colo r","red")
Next
End If
End Sub
[/Code]
What Gag said was right, you don't need to keep an extra counter.
e.Row.RowIndex
will give you the row index, so you could check against that.
You can also apply the style to the row as a whole
[code=vbnet]
Protected Sub MyGridView_RowD ataBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles MyGridView.RowD ataBound
If e.Row.RowIndex> 50
e.Row.Style.Add ("color","re d")
End If
End Sub
[/code]
What Gag said was right, you don't need to keep an extra counter.
e.Row.RowIndex
will give you the row index, so you could check against that.
You can also apply the style to the row as a whole
[code=vbnet]
Protected Sub MyGridView_RowD ataBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles MyGridView.RowD ataBound
If e.Row.RowIndex> 50
e.Row.Style.Add ("color","re d")
End If
End Sub
[/code]
Huh....
Nice :D One less variable to use in my code :D
Comment