Velocity Reviews

Velocity Reviews (
-   ASP .Net Datagrid Control (
-   -   NullReferenceException error on GridView rows loop (

mharness 12-07-2006 03:45 PM

NullReferenceException error on GridView rows loop

I'm trying to do something in a gridview that I've previously done in a
datagrid and can't figure out why it won't work here.

The code will loop through the gridview properly when there is no reference
to chkSelected and ProjectID but when they are referenced I'm getting a
NullReferenceException error (regardless of whether I use the "new"



Protected Sub RemoveSelectedProjects()
Dim myGridView As GridView
Dim ProjectID As New Integer
Dim chkSelected As Boolean
myGridView = Me.gvRequestProjects
Dim row As GridViewRow
For Each row In myGridView.Rows
chkSelected = CType(row.FindControl("chkSelected"),
If chkSelected Then
ProjectID = CType(row.FindControl("ProjectID"), Label).Text
End If
End Sub

All times are GMT. The time now is 08:55 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.