Call Function from assigned Master Page

Discussion in 'ASP .Net' started by Darren.Ratcliffe, Nov 27, 2006.

  1. Hi

    If I have functionX in my master page, how would I call the function
    from my .aspx page that has the master page assigned to it?

    Many thanks

    Darren.Ratcliffe, Nov 27, 2006
    1. Advertisements

  2. Darren.Ratcliffe

    Masudur Guest

    Hi Darren

    Well Let Say you have a Master page name MyMasterPage.Master and its
    codebehind file is
    MyMasterPage.Master.cs. and you have funtionx in MyMasterPage.Master.cs
    and you have default.aspx page and in default.aspx.cs codebehind file
    you want to use the funtion
    here is the code

    ( (MyMasterPage) Page.Master ).Funtionx();
    when u use master page in a page the page object contain the reference
    of the master page
    all you have to cast the Page.Master in your master page file class .
    after that you can use the funtions just like a normal class


    Md. Masudur Rahman
    Kaz Soffware Ltd.
    Masudur, Nov 27, 2006
    1. Advertisements

  3. Thanks for the response Masudur.

    I am going to have a look at this at the start of next week now - I'm
    currently toilling with Indexers!

    Many thanks

    Darren.Ratcliffe, Nov 29, 2006
    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.