[thelist] (ASP.NET) Controls in a repeater

Jonathan Karlen jkarlen at infoniq.com
Thu Sep 15 12:51:33 CDT 2005


You don't do FindControl on the Page object, you do it on the specific item
of the repeater.  The repeater has a collection of items (rptRepeater.Items)
and in each element of that collection exist the controls of the repeater.
Something to the effect of:

Dim x : x = 0
While x < rtpRepeater.Items.Count
	Dim txtBox as TextBox
	txtBox = (TextBox)rptRepeater.Items(x).FindControl("txtMyTextBox")
	MessageBox.Show("This text box said: " + txtBox.Text)
End While

I haven't done .NET in a few months so this could be slightly less than
exact...



-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Tab Alleman
Sent: Thursday, September 15, 2005 1:04 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] (ASP.NET) Controls in a repeater

thelist-bounces at lists.evolt.org wrote:
>> How does one reference the array of controls created by a repeater?
> 
> You'll need to use FindControl.  Dim a variable as the type of control
> (Label), and set it equal to the return value of FindControl.
> 

Thanks.  I read O'Reilly on the FindControl method, but it doesn't answer my
most important question:

If I do:  
Control = Page.FindControl("Foo") 

and there's 10 different checkboxes on my page named "foo", what will the
method return?  an array?  If so, in what order?

-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 





More information about the thelist mailing list