Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2007, 10:45 PM
Registered User
Join Date: Feb 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default FindControl in nested repeater

I keep getting a System.NullReferenceException error when I try to find a control in my nested repeater(rptProducts). I have an image button that on click I need to check to see if any checkboxes have been checked in the nested repeater, I will eventually store this information in a cookie.

Protected Sub ibHR_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibHR.Click

        Dim rptr As Repeater
        Dim d As RepeaterItemEventArgs
        rptr = CType(d.Item.FindControl("rptProducts"), Repeater)

        Dim rc As RepeaterItemCollection = rptr.Items

        For Each Item As RepeaterItem In rc
            Dim MyCheckBox As CheckBox = CType(Item.FindControl("chkProductID"), CheckBox)

            If MyCheckBox.Checked Then
                Response.Write("ProductID = " & MyCheckBox.Attributes("ProductID") & "</br>")
            End If


End Sub

I think the problem is that it can not find the repeater - because I can not access it by name anywhere in the code behind.

Any help would be appreciated. Thank you.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Repeater Using Stored Procedure kwilliams ASP.NET 2.0 Professional 1 July 21st, 2008 06:49 PM
How to dispaly attributes of xml nested repeater.. vishnu108mishra XML 0 November 15th, 2007 07:38 AM
nested repeater ramonjor ASP.NET 2.0 Basics 0 July 31st, 2007 04:18 AM
nested repeater david_ste ASP.NET 2.0 Professional 0 August 24th, 2006 09:52 AM
Why is Findcontrol Failing on a Repeater Postback? HD95 ASP.NET 1.0 and 1.1 Basics 3 January 27th, 2006 09:46 PM

All times are GMT -4. The time now is 04:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.