Tue 18 May 2004
Finding controls in the header and footer
Posted by mattcomroe under .Nizzle
[2] Comments
This is such a pain in the ass it’s not even funny. I need to keep a running total of rows in my repeater, and then put a subtotal column at the bottom. You can’t do a normal FindControl on an item, and I saw weird stuff in the newsgroups about trying to pass a “ctrl1:lblName” to the FindControl, as well as using OnItemDataBound, which doesn’t really work for what I want to do.
So now, for posteriety, is the way to access a server-based control in the footer of a repeater (I’m assuming the same thing would work for headers):
Dim lblFooter As Label
lblFooter = CType(rptSample.Controls(rptSample.Controls.Count – 1).FindControl(“lblFooter”), Label)
lblFooter.Text = “You found me!”
Sheesh.. what a hassle to figure that out.
Update: David asked in the comments if I asked the VB.Net Clippy for help. Yes, yes I did… and here’s the response I got:

Thanks to Pat from the FeralMarketing dept. for the image.

April 30th, 2007 at 9:53 am
Nice One that only took a year…What are using for you blog egine?
April 30th, 2007 at 6:28 pm
i switched from movabletype to wordpress a few months back. not that i even blog anymore but i’m pretty happy with it.