Reach another function in a usercontrol

Discussion in 'ASP .Net' started by Micke Palm, May 4, 2004.

  1. Micke Palm

    Micke Palm Guest

    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
     
    Micke Palm, May 4, 2004
    #1
    1. Advertising

  2. Micke Palm

    Marina Guest

    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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Marina, May 4, 2004
    #2
    1. Advertising

  3. Micke Palm

    Micke Palm Guest

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

    /Thanks, Micke

    "Marina" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
     
    Micke Palm, May 4, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nail
    Replies:
    0
    Views:
    1,563
  2. Support
    Replies:
    2
    Views:
    631
    Support
    Mar 24, 2005
  3. Edwin Knoppert

    Public struct in usercontrol, can't reach items

    Edwin Knoppert, Dec 5, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    335
    Edwin Knoppert
    Dec 5, 2006
  4. Özden Irmak

    Reach UserControl from ASPX codebehind?

    Özden Irmak, Jun 16, 2005, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    165
    Michael Baltic
    Jun 30, 2005
  5. Support

    stuck: I cant reach usercontrol's class ..

    Support, Mar 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    135
    Louis Yeung
    Apr 1, 2005
Loading...

Share This Page