Sharing data between Page and UserControl

Discussion in 'ASP .Net' started by Jason, May 14, 2005.

  1. Jason

    Jason Guest

    I've attempted a few different methods for sharing data between a User
    Control and the Page in which it resides, but none seem to work.

    The UserControl loads some data in the Page_Load method, populates
    private data members and provides access to the data via public
    properties.

    The Page registers the control in the ASPX and I'd like it to
    interrogate the UserControl for its data prior to display.

    I think the fact that I want to do all this during loading is causing
    me problems.

    I've tried:
    UserControl to Page communication (null values)
    Page to UserControl communication (null values)
    Events (complains about null reference)

    Can these two objects communicate when I need them to (before display)
    and, if so, what's the best way?

    I've been using the following as references:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkEventsTutorial.asp
    http://www.openmymind.net/communication/

    Thanks,
    Keith
     
    Jason, May 14, 2005
    #1
    1. Advertisements

  2. Jason

    TC Guest

    I beieve this can only be done via public variables / properties or via a
    query string.

    TC
     
    TC, Jul 19, 2005
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.