Master page / content Page / standard button.

Discussion in 'ASP .Net' started by Francois, Sep 24, 2007.

  1. Francois

    Francois Guest

    I plan a master page / content page design for next application.

    The master page would contain some standard button for my app. For instance
    a "Save" button. (present on all pages).

    But how can I call code in the content.cs page from the Save_Click in the
    master.cs page ?


    Thanks.

    François.
     
    Francois, Sep 24, 2007
    #1
    1. Advertising

  2. Francois

    Elroyskimms Guest

    On Sep 24, 1:00 pm, "Francois" <francois@corebridgecom> wrote:
    > I plan a master page / content page design for next application.
    >
    > The master page would contain some standard button for my app. For instance
    > a "Save" button. (present on all pages).
    >
    > But how can I call code in the content.cs page from the Save_Click in the
    > master.cs page ?
    >
    > Thanks.
    >
    > François.


    I work in VB so you'll have to find the C# equivalent but I think this
    should work for you...

    In the master.cs code Save_Click event handler, you should be able to
    access controls in the content.cs file by:
    me.findcontrol("MyControlName")

    So, if the content to be saved is in a textbox, you should try (in
    your master.cs file):

    dim ContentTextBox as system.web.ui.webcontrols.textbox =
    ctype(me.findcontrol("MyTextBox"), system.web.ui.webcontrols.textbox)

    Now you should be able to access the contents of textbox using the
    ContentTextBox.text

    I'm also new to Master Pages so this may not be 100% accurate. If it
    doesn't work, let me know.

    -E
     
    Elroyskimms, Sep 24, 2007
    #2
    1. Advertising

  3. Francois

    Francois Guest

    This http://www.dotnet-news.com/lien.aspx?ID=25702 is what I was looking
    after.

    Thanks.

    "Elroyskimms" <> a écrit dans le message de news:
    ...
    On Sep 24, 1:00 pm, "Francois" <francois@corebridgecom> wrote:
    > I plan a master page / content page design for next application.
    >
    > The master page would contain some standard button for my app. For
    > instance
    > a "Save" button. (present on all pages).
    >
    > But how can I call code in the content.cs page from the Save_Click in
    > the
    > master.cs page ?
    >
    > Thanks.
    >
    > François.


    I work in VB so you'll have to find the C# equivalent but I think this
    should work for you...

    In the master.cs code Save_Click event handler, you should be able to
    access controls in the content.cs file by:
    me.findcontrol("MyControlName")

    So, if the content to be saved is in a textbox, you should try (in
    your master.cs file):

    dim ContentTextBox as system.web.ui.webcontrols.textbox =
    ctype(me.findcontrol("MyTextBox"), system.web.ui.webcontrols.textbox)

    Now you should be able to access the contents of textbox using the
    ContentTextBox.text

    I'm also new to Master Pages so this may not be 100% accurate. If it
    doesn't work, let me know.

    -E
     
    Francois, Sep 24, 2007
    #3
  4. Francois

    bruce barker Guest

    the first thing to understand is that the master page is a control on
    the content web page (not the other way around).

    this means the master page can expose properties, methods and events
    that the content page can use.

    -- bruce (sqlwork.com)

    Francois wrote:
    > I plan a master page / content page design for next application.
    >
    > The master page would contain some standard button for my app. For instance
    > a "Save" button. (present on all pages).
    >
    > But how can I call code in the content.cs page from the Save_Click in the
    > master.cs page ?
    >
    >
    > Thanks.
    >
    > François.
    >
    >
    >
    >
     
    bruce barker, Sep 24, 2007
    #4
    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. Mark Olbert

    Master Page Button and Detail Page Button

    Mark Olbert, Jan 30, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    632
    Mark Olbert
    Feb 3, 2006
  2. Doug McCann
    Replies:
    1
    Views:
    1,138
    William Brogden
    Aug 5, 2004
  3. Replies:
    0
    Views:
    758
  4. Rolf Welskes
    Replies:
    7
    Views:
    1,015
    Steven Cheng[MSFT]
    Aug 22, 2006
  5. John
    Replies:
    2
    Views:
    943
Loading...

Share This Page