FindControl not working in v2 after conversion from 1.1

G

Guest

I have a web page that makes extensive use of FindControl in the Page.Load
event to dynamicly populate label controls. Worked fine in 1.1 but I get a
"object not set to an instance...or not found" kind of message.

ex,
CType(FindControl("FY" & istring & "PayLabel"),
System.Web.UI.WebControls.Label).Text = YearString

Another difference is that in 1.1 I used a UserControl for a menu and in v2
I am using Master Pages.

Is there something I can do to retrieve this functionality? The v1.1 code is
really useful. I would hate to have to redo it...

Thanks
 
O

Olaf Rabbachin

Hi,

Brad said:
I have a web page that makes extensive use of FindControl in the Page.Load
event to dynamicly populate label controls. Worked fine in 1.1 but I get a
"object not set to an instance...or not found" kind of message.

ex,
CType(FindControl("FY" & istring & "PayLabel"),
System.Web.UI.WebControls.Label).Text = YearString

Another difference is that in 1.1 I used a UserControl for a menu and in v2
I am using Master Pages.

Is there something I can do to retrieve this functionality? The v1.1 code is
really useful. I would hate to have to redo it...

is the control that is causing the problem contained within another control
(i.e., a panel)? You might have to do a recursive loop to also search
controls that themselves host other controls.

Cheers,
Olaf
 
G

Guest

The web page has a master page with a content page. The Master page contains
a ASP.NET menu control and some images. The content is separate. The controls
that I am trying to access are standard label and textbox controls(runat =
server).

It worked fine with 1.1...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top