By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

Reach another function in a usercontrol

P: n/a
Hi!

I have set up one aspx page and I using a few usercontrols to this page. The
treestructure is like below...
aspx
/ \
uCtrl1 uCtrl2
\
uCtrl3

In uCtrl3 I have a public sub with name Test() , now I need to reach this
sub from uCtrl2.
Dim myTestClass as New uCtrl3
myTestClass.Test

Do I need to use "New" coz if I use "New" all control will be NULL? In
uCtrl3 I also have an Table control and here everything goes wrong. When I
use "New" it can't found the Table control and if I don't use "New" it can't
found the class.
I can solved this with other ways like set Panels visible when a criteria is
set, but I think this is a nicer way to do this call or may I've wrong?

/regards, Micke
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Basically, uCtrl2 needs to have a public property that points to its uCtlr3
instance. uCtrl3 needs to have the method you want to call be public.
Then the page can use its uCtrl2 instance, to get to uCtrl3 instance, and
then call the method.

"Micke Palm" <mi***@ripoff.nykoping.net> wrote in message
news:el**************@TK2MSFTNGP11.phx.gbl...
Hi!

I have set up one aspx page and I using a few usercontrols to this page. The treestructure is like below...
aspx
/ \
uCtrl1 uCtrl2
\
uCtrl3

In uCtrl3 I have a public sub with name Test() , now I need to reach this
sub from uCtrl2.
Dim myTestClass as New uCtrl3
myTestClass.Test

Do I need to use "New" coz if I use "New" all control will be NULL? In
uCtrl3 I also have an Table control and here everything goes wrong. When I
use "New" it can't found the Table control and if I don't use "New" it can't found the class.
I can solved this with other ways like set Panels visible when a criteria is set, but I think this is a nicer way to do this call or may I've wrong?

/regards, Micke

Nov 18 '05 #2

P: n/a
Aha, so I need a property. Ok I supspect something like that, but somedays
are harder than others ;)

/Thanks, Micke

"Marina" <so*****@nospam.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
Basically, uCtrl2 needs to have a public property that points to its uCtlr3 instance. uCtrl3 needs to have the method you want to call be public.
Then the page can use its uCtrl2 instance, to get to uCtrl3 instance, and
then call the method.

"Micke Palm" <mi***@ripoff.nykoping.net> wrote in message
news:el**************@TK2MSFTNGP11.phx.gbl...
Hi!

I have set up one aspx page and I using a few usercontrols to this page. The
treestructure is like below...
aspx
/ \
uCtrl1 uCtrl2
\
uCtrl3

In uCtrl3 I have a public sub with name Test() , now I need to reach this sub from uCtrl2.
Dim myTestClass as New uCtrl3
myTestClass.Test

Do I need to use "New" coz if I use "New" all control will be NULL? In
uCtrl3 I also have an Table control and here everything goes wrong. When I use "New" it can't found the Table control and if I don't use "New" it

can't
found the class.
I can solved this with other ways like set Panels visible when a

criteria is
set, but I think this is a nicer way to do this call or may I've wrong?

/regards, Micke


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.