How to call method on Master Page

Last post 08-31-2005 10:44 AM by John Hoge. 2 replies.

Sort Posts:

  • How to call method on Master Page

    08-30-2005, 6:57 PM
    • Participant
      1,226 point Participant
    • John Hoge
    • Member since 11-03-2004, 7:27 AM
    • Posts 341
    I have a Master Page that has a public method called UpdateLabels() that I need to call from a Content page.

    I tried Page.Master.UpdateLabels() but had no luck.

    Thanks,

    John

  • Re: How to call method on Master Page

    08-30-2005, 9:01 PM
    Answer
    • Contributor
      6,537 point Contributor
    • bitmask
    • Member since 07-29-2003, 3:18 PM
    • Citizen of the Earth
    • Posts 1,228
    The safest approach is to use an @ MasterType directive, that will give you a strongly typed Master property.

    I have an example here: http://odetocode.com/Blogs/scott/archive/2005/07/16/1944.aspx
    Scott
    http://www.OdeToCode.com/blogs/scott/
  • Re: How to call method on Master Page

    08-31-2005, 10:44 AM
    • Participant
      1,226 point Participant
    • John Hoge
    • Member since 11-03-2004, 7:27 AM
    • Posts 341
    Thanks Scott,

    I wonder why master pages are not strongly typed by default. Each content page needs to specify a master page class, so it would seem logical that asp.net would see that as a strongly typed master page.

    John

Page 1 of 1 (3 items)