473,835 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1214
Choose the best approach (IMO the first one) and tell us what is the exact
message raised...
--

"David Hearn" <Da*********@sh awinc.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.co m> wrote in message
news:uH******** ******@TK2MSFTN GP04.phx.gbl...
Choose the best approach (IMO the first one) and tell us what is the exact
message raised...
--

"David Hearn" <Da*********@sh awinc.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*********@sh awinc.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.co m> wrote in message
news:uH******** ******@TK2MSFTN GP04.phx.gbl...
Choose the best approach (IMO the first one) and tell us what is the
exact message raised...
--

"David Hearn" <Da*********@sh awinc.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.co m> wrote in message
news:OV******** ******@TK2MSFTN GP04.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*********@sh awinc.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.co m> wrote in message
news:uH******** ******@TK2MSFTN GP04.phx.gbl...
Choose the best approach (IMO the first one) and tell us what is the
exact message raised...
--

"David Hearn" <Da*********@sh awinc.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
2872
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" in the subject of any post to this newsgroup. Please ignore the old thread. I've also updated my webpage http://ece.arizona.edu/~edatools/Python Anyone with some good ideas for "Python 3" is welcome to contribute. I hope GvR won't sue me for...
14
3259
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 go to is a login form, which will set several session variables with the name used to log in, appropriate security level and some other misc variables, and then will go to a main menu for each particular security level using Server.Transfer. ...
6
11317
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" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
9
1532
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 from the control as follows: public string Text { get {
8
2270
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 happens. dim filt as string ... build filter string... UserControl.ReportFilter = filt
3
2683
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 control. In its inactive state, only a single button appears. If the user clicks on this button, the control becomes active( the rest of the control's functionality becomes visible), and all other instances of this user control on the page should...
6
11093
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 how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
41
2897
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 created and then added to "component" objects to build up the component definition. My dilemma comes in deciding how to read/write data to the "item"
14
2269
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 have about 5 or 6 developers testing this web site in a staging environment on a Microsoft 2003 Server box. We have a base page that gets called on every page and checks for session variables. After about 20 - 30 minutes these session variables are...
0
9810
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9653
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10526
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5640
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4435
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.