Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Any other ideas for setting variables in a user control

Reply
Thread Tools

Any other ideas for setting variables in a user control

 
 
David Hearn
Guest
Posts: n/a
 
      05-04-2006
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!


 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      05-04-2006
Choose the best approach (IMO the first one) and tell us what is the exact
message raised...
--

"David Hearn" <(E-Mail Removed)> a écrit dans le message de news:
e$q39$(E-Mail Removed)...
>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!
>



 
Reply With Quote
 
 
 
 
David Hearn
Guest
Posts: n/a
 
      05-04-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Choose the best approach (IMO the first one) and tell us what is the exact
> message raised...
> --
>
> "David Hearn" <(E-Mail Removed)> a écrit dans le message de news:
> e$q39$(E-Mail Removed)...
>>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!
>>

>
>



 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      05-04-2006
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" <(E-Mail Removed)> a écrit dans le message de news:
http://www.velocityreviews.com/forums/(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Choose the best approach (IMO the first one) and tell us what is the
>> exact message raised...
>> --
>>
>> "David Hearn" <(E-Mail Removed)> a écrit dans le message de news:
>> e$q39$(E-Mail Removed)...
>>>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!
>>>

>>
>>

>
>



 
Reply With Quote
 
David Hearn
Guest
Posts: n/a
 
      05-04-2006
Patrice,

You were right. I just treated it as another control and it worked. Thank
you for your help!


"Patrice" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> a écrit dans le message de news:
> (E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Choose the best approach (IMO the first one) and tell us what is the
>>> exact message raised...
>>> --
>>>
>>> "David Hearn" <(E-Mail Removed)> a écrit dans le message de news:
>>> e$q39$(E-Mail Removed)...
>>>>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!
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Access user control from other user control Chris Zopers ASP .Net 3 04-27-2009 10:32 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Result not expected with user control - any ideas why/ Sue ASP .Net Web Controls 6 12-12-2005 09:37 PM
Graphics/Mainboard/Other problem - any ideas please? bch@genie.co.uk Computer Support 6 08-27-2005 07:41 PM



Advertisments