reference to parent page

Discussion in 'ASP .Net' started by dik@lul.com, Jun 20, 2005.

  1. Guest

    Hi

    how do i change a property of a webcontrol that is on a asp.net from the code of a usercontrol? In other words what is the way to refer to the page from this user object?

    ch Dik

    **********************************************************************
    Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
    , Jun 20, 2005
    #1
    1. Advertising

  2. wrote:
    > Hi
    >
    > how do i change a property of a webcontrol that is on a asp.net from the code of a usercontrol? In other words what is the way to refer to the page from this user object?
    >
    > ch Dik
    >
    > **********************************************************************
    > Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
    > Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...


    Well, the UserControl has a .Page property. However, it's bad design
    IMHO for a UserControl to try to access other controls on a page.
    Mainly because a UserControl is supposed to be a 'black box', and
    reusable across pages. Which wouldn't be possible unless all pages
    conform to some 'design' that is common knowledge to all user controls.
    Not common....

    A better design is for a usercontrol to create events that it
    externalizes that the Page class can then handle and do the appropriate
    work. Really the Page class should be the 'controller' in this
    relationship....

    Just a design remark...

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
    Craig Deelsnyder, Jun 20, 2005
    #2
    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. moondaddy
    Replies:
    4
    Views:
    2,838
    John Saunders
    Jun 7, 2004
  2. Roy
    Replies:
    2
    Views:
    3,104
  3. Samy
    Replies:
    0
    Views:
    524
  4. Bill S.
    Replies:
    2
    Views:
    201
    Bill S.
    May 8, 2004
  5. PD
    Replies:
    6
    Views:
    702
Loading...

Share This Page