473,471 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem accessing control from inside other control

I have a validator that I wrote by inheriting from BaseValidator. At certain
points in the code, I need to access other controls on the page containing
the validator. I have the IDs of these controls, so I use the following
statement to access them:

Me.Page.FindControl(ControlID)

However, this is returning Nothing, even though the control can be accessed
in the Load event of the Page containing the control and the validator. I
also want to mention that the Page uses a Master Page, and the control and
validator are declared in the Page, not the Master Page. I am not sure if
this makes a difference or not. Can someone tell me what I am doing wrong?
Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jan 3 '08 #1
3 1554
On Jan 3, 9:19 am, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
I have a validator that I wrote by inheriting from BaseValidator. At certain
points in the code, I need to access other controls on the page containing
the validator. I have the IDs of these controls, so I use the following
statement to access them:

Me.Page.FindControl(ControlID)

However, this is returning Nothing, even though the control can be accessed
in the Load event of the Page containing the control and the validator. I
also want to mention that the Page uses a Master Page, and the control and
validator are declared in the Page, not the Master Page. I am not sure if
this makes a difference or not. Can someone tell me what I am doing wrong?
Thanks.
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/
Can you please give more details on where u want to access and where u
are already able to access the controls as in the server side or the
client side?

If u are able to access the controls on the server side and have
trouble accessing them from the client side, then the solution is
pretty simple. By default the client IDs of the server controls get
pre-pended with specific values (I've generally observed the value
"CT001_" or something similar). Just run the page and view the html
source to see the client id of the controls in the client scripts. U
can also get the client id of the controls using a property on the
server side.

Hope this helps

Regards, Dina
Jan 3 '08 #2
As I mentioned in my original post, I am able to access the control in the
Load event of the Page. The place where I want to and am not able to access
it is in the EvaluateIsValid() function of my validator. In the
EvaluateIsValid() function I am attempting to access it using the following:

Me.Page.FindControl(ControlID)

Because the Load event of the Page occurs before the EvaluateIsValid()
function is called, this shows that the control does exist in the page when
I try to access it. Is there something else I need to do when accessing the
control from inside EvaluateIsValid()? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Dina" <di*********@gmail.comwrote in message
news:71**********************************@i29g2000 prf.googlegroups.com...
On Jan 3, 9:19 am, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
>I have a validator that I wrote by inheriting from BaseValidator. At
certain
points in the code, I need to access other controls on the page
containing
the validator. I have the IDs of these controls, so I use the following
statement to access them:

Me.Page.FindControl(ControlID)

However, this is returning Nothing, even though the control can be
accessed
in the Load event of the Page containing the control and the validator. I
also want to mention that the Page uses a Master Page, and the control
and
validator are declared in the Page, not the Master Page. I am not sure if
this makes a difference or not. Can someone tell me what I am doing
wrong?
Thanks.
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/

Can you please give more details on where u want to access and where u
are already able to access the controls as in the server side or the
client side?

If u are able to access the controls on the server side and have
trouble accessing them from the client side, then the solution is
pretty simple. By default the client IDs of the server controls get
pre-pended with specific values (I've generally observed the value
"CT001_" or something similar). Just run the page and view the html
source to see the client id of the controls in the client scripts. U
can also get the client id of the controls using a property on the
server side.

Hope this helps

Regards, Dina

Jan 3 '08 #3
On Jan 3, 10:42 am, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
As I mentioned in my original post, I am able to access the control in the
Load event of the Page. The place where I want to and am not able to access
it is in the EvaluateIsValid() function of my validator. In the
EvaluateIsValid() function I am attempting to access it using the following:

Me.Page.FindControl(ControlID)

Because the Load event of the Page occurs before the EvaluateIsValid()
function is called, this shows that the control does exist in the page when
I try to access it. Is there something else I need to do when accessing the
control from inside EvaluateIsValid()? Thanks.
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/

"Dina" <dina.mrc...@gmail.comwrote in message

news:71**********************************@i29g2000 prf.googlegroups.com...
On Jan 3, 9:19 am, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
I have a validator that I wrote by inheriting from BaseValidator. At
certain
points in the code, I need to access other controls on the page
containing
the validator. I have the IDs of these controls, so I use the following
statement to access them:
Me.Page.FindControl(ControlID)
However, this is returning Nothing, even though the control can be
accessed
in the Load event of the Page containing the control and the validator. I
also want to mention that the Page uses a Master Page, and the control
and
validator are declared in the Page, not the Master Page. I am not sure if
this makes a difference or not. Can someone tell me what I am doing
wrong?
Thanks.
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/
Can you please give more details on where u want to access and where u
are already able to access the controls as in the server side or the
client side?
If u are able to access the controls on the server side and have
trouble accessing them from the client side, then the solution is
pretty simple. By default the client IDs of the server controls get
pre-pended with specific values (I've generally observed the value
"CT001_" or something similar). Just run the page and view the html
source to see the client id of the controls in the client scripts. U
can also get the client id of the controls using a property on the
server side.
Hope this helps
Regards, Dina
Did u find the control's client ID by looking into the HTML source
generated at the browser? Use that ID in the FindControl function.

Regards, Dina
Jan 10 '08 #4

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

Similar topics

3
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture...
6
by: John Bowman | last post by:
Hi, I have a C# app that needs to launch the "Add Scheduled Tasks" wizard found in the control panel "Scheduled Tasks" applet. I realize that this "applet" really just opens the tasks folder,...
4
by: Moojjoo | last post by:
Ok fellow C# developers: How do creat an instance of an object inside a dataset or datagrid. Example I need to have a placeholder inside a dataset. Any help would be great.
1
by: Peter | last post by:
Hi, I'm getting the following error when I run/debug my application: Could not load type 'MyApplication.SomeNamespace.SomeClassInNamespace' To give you more background information I...
9
by: Ric | last post by:
im new to asp.net. please help if u can. is it possible to refer to a control(ie lable, placeholder, textbox) that is inside a repeater object from a code behind file? when i place the control...
5
by: Alex Maghen | last post by:
Hi. If I create a WebControl (User Control, actually), I know how, easily, to access the design-time Properties that have been set as Propertiy nodes in the tag used on the ASPX page. But I've...
3
by: Jeff | last post by:
Hey asp.net 2.0 In the source I posted below, there is a GridView (look at the bottom of the script): <asp:GridView ID="gvwOnline" runat="server"> </asp:GridView> I'm trying to assign a...
4
by: Nitinkcv | last post by:
Hi all, Currently im using 1.1 framework. Here i have a textbox which is inside a repeater. Now the functionality of this textbox is to take the input from the usr regarding the available time...
1
by: NishChaks | last post by:
Hi, I have a texbox which is a template column of a grid and the grid is inside the repeater. If there is only one control in the repeater then we can use foreach (RepeaterItem item in...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.