Passing values between user controls

Discussion in 'ASP .Net Web Controls' started by Peter K, Jan 13, 2010.

  1. Peter K

    Peter K Guest

    Hi

    I have a page (aspx) which contains many ascx controls.

    One of the ascx controls has a date-selection control, and when this is
    changed some of the other ascx's have to respond by changing their display
    appropriately.

    What is the best way of achieving this?

    Presently, in the "date selection" control, I fire an event when the date
    selection changes.
    The main page (aspx) subscribes to this event (from which it obtains the new
    date), and then calls special public methods on the other ascx's to supply
    them the date.

    Is this an ok method? It means the aspx has to know all its child ascx's
    which need to know the new date. Is it possible to fire another event in the
    aspx, which the relevant child ascx's subscribe to?


    Thanks,
    Peter
     
    Peter K, Jan 13, 2010
    #1
    1. Advertisements

  2. It sounds like a very efficient technique for accomplishing your goal. Have
    you actually tried it yet, or are you just asking before trying to write the
    code (not that either one is bad)? I am asking this because if you have
    tried it and there was a problem, we may be able to help you more if you
    show us the code and/or error. Good luck!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Peter K" <> wrote in message
    news:#...
    > Hi
    >
    > I have a page (aspx) which contains many ascx controls.
    >
    > One of the ascx controls has a date-selection control, and when this is
    > changed some of the other ascx's have to respond by changing their display
    > appropriately.
    >
    > What is the best way of achieving this?
    >
    > Presently, in the "date selection" control, I fire an event when the date
    > selection changes.
    > The main page (aspx) subscribes to this event (from which it obtains the
    > new date), and then calls special public methods on the other ascx's to
    > supply them the date.
    >
    > Is this an ok method? It means the aspx has to know all its child ascx's
    > which need to know the new date. Is it possible to fire another event in
    > the aspx, which the relevant child ascx's subscribe to?
    >
    >
    > Thanks,
    > Peter
    >
     
    Nathan Sokalski, Feb 18, 2010
    #2
    1. Advertisements

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. =?Utf-8?B?RGF2ZQ==?=

    Pass values between user controls?

    =?Utf-8?B?RGF2ZQ==?=, Jun 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,346
    Tanveer1909
    Sep 13, 2010
  2. Richard Payne

    Passing Objects between Web User Controls

    Richard Payne, Jun 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,857
    Steven Cheng[MSFT]
    Jun 10, 2004
  3. Replies:
    0
    Views:
    511
  4. Replies:
    1
    Views:
    1,333
    sloan
    Mar 20, 2006
  5. Arulraja

    Passing values between Custom controls?

    Arulraja, Oct 21, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    273
    Victor Garcia Aprea [MVP]
    Oct 23, 2003
  6. Faizan Ahmed
    Replies:
    1
    Views:
    503
    John Saunders
    Jan 4, 2005
  7. Dave E

    Passing values to user controls - naughty problem

    Dave E, Jul 2, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    368
    Alessandro Zifiglio
    Jul 3, 2006
  8. Replies:
    3
    Views:
    510
    Angel
    Feb 6, 2008
Loading...