473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

FindControl not working in v2 after conversion from 1.1

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
--
Brad

"Software is like melted pudding..."
Nov 9 '06 #1
3 1106
Hi,

Brad Roberts wrote:
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
--
My .02: www.Resources.IntuiDev.com
Nov 10 '06 #2
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...

--
Brad

"Software is like melted pudding..."
"Olaf Rabbachin" wrote:
Hi,

Brad Roberts wrote:
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
--
My .02: www.Resources.IntuiDev.com
Nov 13 '06 #3
Found it. I just did not search as well as I should have.

http://msdn2.microsoft.com/en-us/library/xxwa0ff0.aspx

--
Brad

"Software is like melted pudding..."
"Brad Roberts" wrote:
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...

--
Brad

"Software is like melted pudding..."
"Olaf Rabbachin" wrote:
Hi,

Brad Roberts wrote:
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
--
My .02: www.Resources.IntuiDev.com
Nov 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ivan Demkovitch | last post by:
Hi! I have following problem: When I create control dynamically and assign ID to it it get's changed if you look at output HTML. Because I add this control inside ascx it is prefixed with...
1
by: Michael Murschell | last post by:
If I call Page.FindControl() on an aspx, it finds the control, but if I call it on an ASCX, it does not. Why not? And how would I call it?
1
by: tshad | last post by:
I am using sample code from C# and am trying to convert it to VB.Net in my aspx page. This works in C#: DataGrid oGrid = (DataGrid)oItem.FindControl("DataGrid1"); I have tried all kinds of...
10
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
2
by: sck10 | last post by:
Hello, I am trying to get the value of a control in a FormView. In vb, I would use the following: e.NewValues("ServiceIdeaQ01") =...
5
by: daniel.hedz | last post by:
I am generating a usercontrol dynamically successfully, but when I try to find that usercontrol I get a type mismatch. This is what I am doing: //Loading my usercontrol...
14
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I have created a UserControl ("MyUC"). I've put a bunch of instances of that control on a Page ("Defaul.aspx"). The control works fine. Now, I want to be able to use "FindControl()" from...
7
by: AAaron123 | last post by:
Me.FindControl("MissionScheduleID"), below returns null. Do you know what I'm doing wrong? Thanks ***In my .aspx file I have: asp:Content ID="Content3"...
9
by: AAaron123 | last post by:
I'm this far in determining the correct code to find a textbox I need to set. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.