P
Plateriot
I was looking to format the text of certain values in my gridview, but I have
a question first:
1) If I don't use an ObjectDataSource - but instead manually populate the
gridview - does it invalidate the RowDataBound event?
The reason I ask - is that even though I can see the values in this
gridview, it seems as though I am asking for them too early
Here's my RowDataBound event :
Protected Sub gvBP_Detail_AM_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim strSBP As String = e.Row.Cells(0).Text
Dim strDBP As String = e.Row.Cells(1).Text
Dim iSBP, iDBP, iSBPTarget, iDBPTarget As Integer
iSBP = Int32.Parse(strSBP)
iDBP = Int32.Parse(strDBP)
iSBPTarget = Int32.Parse(Me.txtSBP_Target.Text)
iDBPTarget = Int32.Parse(Me.txtDBP_Target.Text)
If iSBP > iSBPTarget Then e.Row.Cells(0).ForeColor =
Drawing.Color.Red
If iDBP > iDBPTarget Then e.Row.Cells(1).ForeColor =
Drawing.Color.Red
End If
End Sub
but, right off the bat, it doesn't see any value in e.row.cells(0).text -
which I can plainly see has the text "120" --- any idea why?
a question first:
1) If I don't use an ObjectDataSource - but instead manually populate the
gridview - does it invalidate the RowDataBound event?
The reason I ask - is that even though I can see the values in this
gridview, it seems as though I am asking for them too early
Here's my RowDataBound event :
Protected Sub gvBP_Detail_AM_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim strSBP As String = e.Row.Cells(0).Text
Dim strDBP As String = e.Row.Cells(1).Text
Dim iSBP, iDBP, iSBPTarget, iDBPTarget As Integer
iSBP = Int32.Parse(strSBP)
iDBP = Int32.Parse(strDBP)
iSBPTarget = Int32.Parse(Me.txtSBP_Target.Text)
iDBPTarget = Int32.Parse(Me.txtDBP_Target.Text)
If iSBP > iSBPTarget Then e.Row.Cells(0).ForeColor =
Drawing.Color.Red
If iDBP > iDBPTarget Then e.Row.Cells(1).ForeColor =
Drawing.Color.Red
End If
End Sub
but, right off the bat, it doesn't see any value in e.row.cells(0).text -
which I can plainly see has the text "120" --- any idea why?