[thelist] (ASP.NET) Controls in a repeater
Tab Alleman
talleman at Lumpsum.com
Fri Sep 16 11:08:11 CDT 2005
thelist-bounces at lists.evolt.org wrote:
> 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...
>
Thanks, this got me there... for the curious, the final working syntax looked more like this:
Dim x As Int16
Dim txtBox As TextBox
For x = 0 To rptRepeater.Items.Count - 1
txtBox = DirectCast(rptRepeater.Items(x).FindControl("txtMyTextBox"), TextBox)
MessageBox.Show("This text box said: " + txtBox.Text)
Next
More information about the thelist
mailing list