Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Passing values to user controls - naughty problem

Reply
Thread Tools

Passing values to user controls - naughty problem

 
 
Dave E
Guest
Posts: n/a
 
      07-02-2006
Hi all,

right now I feel pretty dumb - even dumber than I look. I have read endless
web articles on this, including the excellent site by Steve Orr
(http://steveorr.net/faq/PassDataToUserControl.aspx) on this very issue,
sadly to no avail in my case.

I've followed the examples and can only get the glorious "Object reference
not set to an instance of an object" error when I attempt to set the public
property on the control. Intellisense picks up the [IsCheckout] property on
the control and so at least that part is OK. I tried calling a public sub
on the control from a button press on the parent page but same error.

Essentially I just want to pass a simple boolean to the control to give it
context but this one has cost me much sleep - must be a *very* simple answer
I'm guessing.

My code is as follows (please don't laugh...):

[------- My control (i_cart_list1) --]

Private blnIsCheckout As Boolean

Public Property IsCheckout() As Boolean
Get
Return blnIsCheckout
End Get

Set(ByVal Value As Boolean)
blnIsCheckout = Value
End Set
End Property


[------- Parent page --]

Protected WithEvents Checkout As i_cart_list1

Private Sub Page_Load(blah blah here...)
Checkout.IsCheckout = True '<== Error happens here
End Sub

-----------------------------

Many thanks in advance for any help on this nasty.

Cheers,
David E (Sydney)


 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      07-02-2006
Dave, in your .aspx page that contains your user control, make sure that the
id of the user control is the same id you used in the codebehind for that
page. From your example it seems as though the id is Checkout. Are you sure,
can you verify this ? I think this is the problem as to why your control is
returning an object reference error.

Regards,
Alessandro Zifiglio
"Dave E" <(E-Mail Removed)> ha scritto nel messaggio
news:44a7d387$0$17549$(E-Mail Removed)...
> Hi all,
>
> right now I feel pretty dumb - even dumber than I look. I have read
> endless web articles on this, including the excellent site by Steve Orr
> (http://steveorr.net/faq/PassDataToUserControl.aspx) on this very issue,
> sadly to no avail in my case.
>
> I've followed the examples and can only get the glorious "Object reference
> not set to an instance of an object" error when I attempt to set the
> public property on the control. Intellisense picks up the [IsCheckout]
> property on the control and so at least that part is OK. I tried calling
> a public sub on the control from a button press on the parent page but
> same error.
>
> Essentially I just want to pass a simple boolean to the control to give it
> context but this one has cost me much sleep - must be a *very* simple
> answer I'm guessing.
>
> My code is as follows (please don't laugh...):
>
> [------- My control (i_cart_list1) --]
>
> Private blnIsCheckout As Boolean
>
> Public Property IsCheckout() As Boolean
> Get
> Return blnIsCheckout
> End Get
>
> Set(ByVal Value As Boolean)
> blnIsCheckout = Value
> End Set
> End Property
>
>
> [------- Parent page --]
>
> Protected WithEvents Checkout As i_cart_list1
>
> Private Sub Page_Load(blah blah here...)
> Checkout.IsCheckout = True '<== Error happens here
> End Sub
>
> -----------------------------
>
> Many thanks in advance for any help on this nasty.
>
> Cheers,
> David E (Sydney)
>



 
Reply With Quote
 
 
 
 
Dave E
Guest
Posts: n/a
 
      07-03-2006
"Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> wrote in
message news:%(E-Mail Removed)...
> Dave, in your .aspx page that contains your user control, make sure that
> the id of the user control is the same id you used in the codebehind for
> that page. From your example it seems as though the id is Checkout. Are
> you sure, can you verify this ? I think this is the problem as to why your
> control is returning an object reference error.
>
> Regards,
> Alessandro Zifiglio


Hi Alessandro,

well, my sincere thanks to you - you've saved me from tearing the final few
strands of hair out! I was right on one point though... it was a
ridiculously easy solution, but clearly way beyond me!

Many thanks and I appreciate your time.

Cheers from Sydney,
Dave E


 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      07-03-2006
Dave, you are welcome
have a good day,
Alessandro Zifiglio
"Dave E" <(E-Mail Removed)> ha scritto nel messaggio
news:44a86745$0$17541$(E-Mail Removed)...
> "Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> wrote in
> message news:%(E-Mail Removed)...
>> Dave, in your .aspx page that contains your user control, make sure that
>> the id of the user control is the same id you used in the codebehind for
>> that page. From your example it seems as though the id is Checkout. Are
>> you sure, can you verify this ? I think this is the problem as to why
>> your control is returning an object reference error.
>>
>> Regards,
>> Alessandro Zifiglio

>
> Hi Alessandro,
>
> well, my sincere thanks to you - you've saved me from tearing the final
> few strands of hair out! I was right on one point though... it was a
> ridiculously easy solution, but clearly way beyond me!
>
> Many thanks and I appreciate your time.
>
> Cheers from Sydney,
> Dave E
>



 
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
Oh you naughty naughty downloaders Troggles NZ Computing 2 04-12-2006 11:29 PM
Naughty Language Norman White Computer Support 12 04-06-2005 05:44 PM
Curvy glamorous babe who enjoys naughty company Kate Computer Support 1 08-06-2004 06:28 PM



Advertisments