Re: Access Values in User Control from container control

Discussion in 'ASP .Net' started by Karl, Sep 15, 2004.

  1. Karl

    Karl Guest

    Expose the values of the inner user controls as readonly properties:

    page
    --> usercontrol "containter"
    --> usercontrol "sub1"
    --> usercontrol "sub2"

    sub1 and sub2 are defined something like:

    <mine:Sub1 runat="server" id="x" />
    <mine:Sub2 runat="server" id="y" />

    public class Sub1
    inherits UserControl

    public readonly property UserNameValue() as string
    get
    return username.Text
    end get
    end property
    ...
    end sub


    container can then access these via

    protecte x as Sub1

    sub page_load
    x.UserNameValue
    end sub

    Karl
    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Neil" <> wrote in message
    news:...
    > Hi,
    >
    > I have a User Control that acts as a container control for several other
    > user controls. Each of these user controls has some textboxes, dropdowns

    etc.
    > After the user has made the necessary changes they will click the Save
    > Changes Button that resides in the container control, I now need to access
    > the values in these other user controls.
    > What is the best way to do this?
    >
    > Thanks
    Karl, Sep 15, 2004
    #1
    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. Vivi Orunitia
    Replies:
    11
    Views:
    4,447
    Martijn Lievaart
    Feb 4, 2004
  2. Maitre Bart
    Replies:
    2
    Views:
    510
    Maitre Bart
    Feb 11, 2004
  3. Steven T. Hatton
    Replies:
    4
    Views:
    3,869
    Rob Williscroft
    Dec 5, 2004
  4. Replies:
    4
    Views:
    780
    Daniel T.
    Feb 16, 2006
  5. wolverine
    Replies:
    2
    Views:
    437
    Marcus Kwok
    Jul 24, 2006
Loading...

Share This Page