T
tfsmag
I'm having a weird problem with the rowdatabound event for a gridview
in my application... Here is the code.
--------------------------------------
Protected Sub AnswersGrid_RowDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
AnswersGrid.RowDataBound
If e.Row.Cells(1).Text = "True" Or e.Row.Cells.Item(1).Text =
"False" Then
Dim editbutton As LinkButton =
e.Row.FindControl("LinkButton1")
editbutton.Visible = False
End If
If e.Row.Cells(0).Text = "Y" Then
e.Row.Cells(1).BackColor = Drawing.Color.LightGray
End If
e.Row.Cells(0).Visible = False
End Sub
-----------------------------------
The problem is that the gridview has 4 cells, and if i print out the
e.row.cells.count it comes up as 4. However, when I try to see if the
text in cell(1) is "true" or "false" it tells me that the index is out
of range. I know that it is not out of range because it let's me set
the background color of cell(1) at the bottom of the code. Any ideas
what's going on or how to resolve it?
in my application... Here is the code.
--------------------------------------
Protected Sub AnswersGrid_RowDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
AnswersGrid.RowDataBound
If e.Row.Cells(1).Text = "True" Or e.Row.Cells.Item(1).Text =
"False" Then
Dim editbutton As LinkButton =
e.Row.FindControl("LinkButton1")
editbutton.Visible = False
End If
If e.Row.Cells(0).Text = "Y" Then
e.Row.Cells(1).BackColor = Drawing.Color.LightGray
End If
e.Row.Cells(0).Visible = False
End Sub
-----------------------------------
The problem is that the gridview has 4 cells, and if i print out the
e.row.cells.count it comes up as 4. However, when I try to see if the
text in cell(1) is "true" or "false" it tells me that the index is out
of range. I know that it is not out of range because it let's me set
the background color of cell(1) at the bottom of the code. Any ideas
what's going on or how to resolve it?