Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Call a sub from 1 usercontrol to another.

Reply
Thread Tools

Call a sub from 1 usercontrol to another.

 
 
Jay
Guest
Posts: n/a
 
      03-10-2005
Guys, I'm stuck!!!

I have two usercontrosl, in UC2 I had a public sub which I want to call
from UC1. Both UC's are on the same aspx page.

In UC1 I have teh following line at the top of the ascx:

Protected WithEvents ucPdqmBasketMini As pdqmBasketMini

IN UC2 the sub looks like:

Public Sub pdqmAddItem(ByVal intProdID As Int32)
lblTotal.Text = "add item " & intProdID
End Sub

The lblTotal label is member of the .aspx/vb page.

When I call the Sub from UC1 with the following:

ucPdqmBasketMini.pdqmAddItem(intProdID)

I get the error:

Object reference not set to an instance of an object.

So thinking UC1 cannot see UC2 I added the following declaration in the
ascx of UC1:

<%@ Register TagPrefix="uc1" TagName="pdqmBasketMini"
Src="pdqmBasketMini.ascx" %>

Still no joy. Any ideas what I am doing wrong?
 
Reply With Quote
 
 
 
 
Jay
Guest
Posts: n/a
 
      03-10-2005
In addition, when I call the sub the aspx.vb which has both UC's
registered, there's no problem at all.
 
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
Death To Sub-Sub-Sub-Directories! Lawrence D'Oliveiro Java 92 05-20-2011 06:50 AM
Recognising Sub-Items and sub-sub items using xslt Ben XML 2 09-19-2007 09:35 AM
How to call a Method in a UserControl from another UserControl jsausten@hotmail.com ASP .Net Web Controls 1 08-11-2006 09:53 AM
Can we use a usercontrol inside a usercontrol Rajesh Tiwari ASP .Net 0 08-12-2003 03:56 PM
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack huobazi ASP .Net 1 07-03-2003 03:14 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57