473,322 Members | 1,405 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,322 software developers and data experts.

Any other ideas for setting variables in a user control

I need to pass some variables to a user control so that some functions that
are in it can use them. I am trying to set a public property that I have in
it but it isn't working for some reason and I really need to get this
working. Any ideas? I have tried calling the functions directly from the
parent page's page load event, but that doesn't work because the controls
aren't rendered yet and I keep getting Object not set to reference errors.

Thanks in advance!
May 4 '06 #1
4 1190
Choose the best approach (IMO the first one) and tell us what is the exact
message raised...
--

"David Hearn" <Da*********@shawinc.com> a écrit dans le message de news:
e$**************@TK2MSFTNGP05.phx.gbl...
I need to pass some variables to a user control so that some functions that
are in it can use them. I am trying to set a public property that I have in
it but it isn't working for some reason and I really need to get this
working. Any ideas? I have tried calling the functions directly from the
parent page's page load event, but that doesn't work because the controls
aren't rendered yet and I keep getting Object not set to reference errors.

Thanks in advance!

May 4 '06 #2
Patrice,

I set the property and can see it come in just fine as it is being set, but
by the time I try to use it in calling a function, the variable is set to
nothing again. It's getting lost or something is resetting it. See my
previous post just below this one about problem accessing proerty in User
control.

Thanks!

"Patrice" <sc****@chez.com> wrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
Choose the best approach (IMO the first one) and tell us what is the exact
message raised...
--

"David Hearn" <Da*********@shawinc.com> a écrit dans le message de news:
e$**************@TK2MSFTNGP05.phx.gbl...
I need to pass some variables to a user control so that some functions
that are in it can use them. I am trying to set a public property that I
have in it but it isn't working for some reason and I really need to get
this working. Any ideas? I have tried calling the functions directly from
the parent page's page load event, but that doesn't work because the
controls aren't rendered yet and I keep getting Object not set to
reference errors.

Thanks in advance!


May 4 '06 #3
Ok, as reported by Marina looks like you create a new instance, set the
property and set it to nothing again (basically it has no effect).

If you dropped the user control on your page you have a variable that is
automatically created there for you and that allows to handle this control
(check its name in the design view).
You can then use this variable to set the needed property.

This is very similar to using any other control...

--
Patrice

"David Hearn" <Da*********@shawinc.com> a écrit dans le message de news:
et**************@TK2MSFTNGP03.phx.gbl...
Patrice,

I set the property and can see it come in just fine as it is being set,
but by the time I try to use it in calling a function, the variable is set
to nothing again. It's getting lost or something is resetting it. See my
previous post just below this one about problem accessing proerty in User
control.

Thanks!

"Patrice" <sc****@chez.com> wrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
Choose the best approach (IMO the first one) and tell us what is the
exact message raised...
--

"David Hearn" <Da*********@shawinc.com> a écrit dans le message de news:
e$**************@TK2MSFTNGP05.phx.gbl...
I need to pass some variables to a user control so that some functions
that are in it can use them. I am trying to set a public property that I
have in it but it isn't working for some reason and I really need to get
this working. Any ideas? I have tried calling the functions directly from
the parent page's page load event, but that doesn't work because the
controls aren't rendered yet and I keep getting Object not set to
reference errors.

Thanks in advance!



May 4 '06 #4
Patrice,

You were right. I just treated it as another control and it worked. Thank
you for your help!
"Patrice" <sc****@chez.com> wrote in message
news:OV**************@TK2MSFTNGP04.phx.gbl...
Ok, as reported by Marina looks like you create a new instance, set the
property and set it to nothing again (basically it has no effect).

If you dropped the user control on your page you have a variable that is
automatically created there for you and that allows to handle this control
(check its name in the design view).
You can then use this variable to set the needed property.

This is very similar to using any other control...

--
Patrice

"David Hearn" <Da*********@shawinc.com> a écrit dans le message de news:
et**************@TK2MSFTNGP03.phx.gbl...
Patrice,

I set the property and can see it come in just fine as it is being set,
but by the time I try to use it in calling a function, the variable is
set to nothing again. It's getting lost or something is resetting it. See
my previous post just below this one about problem accessing proerty in
User control.

Thanks!

"Patrice" <sc****@chez.com> wrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
Choose the best approach (IMO the first one) and tell us what is the
exact message raised...
--

"David Hearn" <Da*********@shawinc.com> a écrit dans le message de news:
e$**************@TK2MSFTNGP05.phx.gbl...
I need to pass some variables to a user control so that some functions
that are in it can use them. I am trying to set a public property that I
have in it but it isn't working for some reason and I really need to get
this working. Any ideas? I have tried calling the functions directly
from the parent page's page load event, but that doesn't work because
the controls aren't rendered yet and I keep getting Object not set to
reference errors.

Thanks in advance!



May 4 '06 #5

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

Similar topics

14
by: David MacQuigg | last post by:
I am starting a new thread so we can avoid some of the non-productive argument following my earlier post "What is good about Prothon". At Mr. Hahn's request, I will avoid using the name "Prothon"...
14
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
9
by: Alphonse Giambrone | last post by:
I have built a simple composite control that consists of a textbox, requiredfieldvalidator and rangevalidator. For properties that are unique to the individual control, I set/get them directly...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
14
by: Rick | last post by:
We are in the process of testing a large web project that I converted from VS 2003 to VS 2005. Everything seems to be working except for a few minor things. But the main issue I have is this, I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.