By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,296 Members | 1,428 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,296 IT Pros & Developers. It's quick & easy.

gridview rowdatabound cell index bug?

P: n/a
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?

May 8 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.