MasterPages - take plain form, add MasterPage. MasterPage does NOT appear when run

Discussion in 'ASP .Net' started by Randy Smith, Apr 13, 2007.

  1. Randy Smith

    Randy Smith Guest

    Hi,
    I now need to add MasterPages to a number of existing forms, but when I add
    the code for MasterPage, the MasterPage does NOT appear when it runs.

    Any thoughts?

    TIA, Randy Smith
    Randy Smith, Apr 13, 2007
    #1
    1. Advertising

  2. Randy Smith

    Mark Rae Guest

    "Randy Smith" <> wrote in message
    news:%...

    > I now need to add MasterPages to a number of existing forms, but when I
    > add the code for MasterPage, the MasterPage does NOT appear when it runs.
    >
    > Any thoughts?


    Well, firstly, what do you mean by "existing forms"...? When you say "form",
    do you mean ASPX page...?

    How do you "add the code for MasterPage"...?
    Mark Rae, Apr 13, 2007
    #2
    1. Advertising

  3. Sorry, but what you saying is not very understandable. I can understand each
    word separately but not the whole sentce :)

    Anyway in order to use master page you need to have reference to it on your
    main page
    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"%>



    Master page shoudl have something like

    <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">

    </asp:contentplaceholder>

    somewere. It's where content will go

    And the page should have
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">

    CONTENT

    </asp:Content>


    The best thing for you to do is to create one dummy page with master page
    using wizard and look how it's done



    George


    "Randy Smith" <> wrote in message
    news:%...
    > Hi,
    > I now need to add MasterPages to a number of existing forms, but when I
    > add the code for MasterPage, the MasterPage does NOT appear when it runs.
    >
    > Any thoughts?
    >
    > TIA, Randy Smith
    >
    George Ter-Saakov, Apr 13, 2007
    #3
  4. Randy Smith

    bpd Guest

    Re: MasterPages - take plain form, add MasterPage. MasterPage does NOT appear when run

    On Apr 13, 2:31 pm, "Randy Smith" <> wrote:
    > Hi,
    > I now need to add MasterPages to a number of existing forms, but when I add
    > the code for MasterPage, the MasterPage does NOT appear when it runs.
    >
    > Any thoughts?
    >
    > TIA, Randy Smith


    Make sure your Page directive includes MasterPageFile=<your master
    page here>. For example, from one of my projects:
    <%@ Page Language="C#" MasterPageFile="~/rc.master"
    AutoEventWireup="true" CodeFile="Modifier_Customer.aspx.cs"
    Inherits="Modifier_Customer" Title="Customer Modifier" %>
    bpd, Apr 13, 2007
    #4
  5. Randy Smith

    Randy Smith Guest

    Hi,
    I have an existing web site, but now need to add MasterPages. So, I've
    taken existing aspx.pages and added this code:
    MasterPageFile="MasterPage.master"



    I've made sure that my html form elements are wrapped in:

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">

    AND ..................... </asp:Content>



    IN SPITE OF THIS, my MasterPage elements do NOT appear.



    TIA, Randy Smith


    "Mark Rae" <> wrote in message
    news:...
    > "Randy Smith" <> wrote in message
    > news:%...
    >
    >> I now need to add MasterPages to a number of existing forms, but when I
    >> add the code for MasterPage, the MasterPage does NOT appear when it runs.
    >>
    >> Any thoughts?

    >
    > Well, firstly, what do you mean by "existing forms"...? When you say
    > "form", do you mean ASPX page...?
    >
    > How do you "add the code for MasterPage"...?
    >
    Randy Smith, Apr 13, 2007
    #5
  6. Randy Smith

    Randy Smith Guest

    Hi,
    I have an existing web site, but now need to add MasterPages. So, I've
    taken existing aspx.pages and added this code:
    MasterPageFile="MasterPage.master"



    I've made sure that my html form elements are wrapped in:

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    Runat="Server">

    AND ..................... </asp:Content>



    IN SPITE OF THIS, my MasterPage elements do NOT appear.



    TIA, Randy Smith


    "Mark Rae" <> wrote in message
    news:...
    > "Randy Smith" <> wrote in message
    > news:%...
    >
    >> I now need to add MasterPages to a number of existing forms, but when I
    >> add the code for MasterPage, the MasterPage does NOT appear when it runs.
    >>
    >> Any thoughts?

    >
    > Well, firstly, what do you mean by "existing forms"...? When you say
    > "form", do you mean ASPX page...?
    >
    > How do you "add the code for MasterPage"...?
    >
    Randy Smith, Apr 13, 2007
    #6
  7. Randy Smith

    Mark Rae Guest

    "Randy Smith" <> wrote in message
    news:...

    > I have an existing web site, but now need to add MasterPages. So, I've
    > taken existing aspx.pages and added this code:
    > MasterPageFile="MasterPage.master"


    So your MasterPage is in the same folder as all your content pages...?

    > I've made sure that my html form elements are wrapped in:
    >
    > <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    > Runat="Server">
    >
    > AND ..................... </asp:Content>


    By "wrapped in", I take it that you have removed all of the other <html>
    tags like <header>, <body> etc from your content pages...?
    Mark Rae, Apr 13, 2007
    #7
  8. Randy Smith

    Randy Smith Guest

    Well, I did have the MasterPages in the same folder, then I tried placing
    the MasterPage in my main website folder, but that didn't seem to make any
    difference either. Here's what my solution folders look like:

    /GWO (.NET 2005 solution)
    /Web
    - Login aspx.form (redirects to appropriate folder based on
    user role)
    /OffSvcs
    - aspx forms
    - MasterPage (for Office Services employees)
    /User
    - aspx forms
    - MasterPage (for general users)
    /AcctUser
    - aspx forms
    - MasterPage (for accounting users)
    /GWO (class libraries and datamappers)

    TIA, Randy





    "Mark Rae" <> wrote in message
    news:...
    > "Randy Smith" <> wrote in message
    > news:...
    >
    >> I have an existing web site, but now need to add MasterPages. So, I've
    >> taken existing aspx.pages and added this code:
    >> MasterPageFile="MasterPage.master"

    >
    > So your MasterPage is in the same folder as all your content pages...?
    >
    >> I've made sure that my html form elements are wrapped in:
    >>
    >> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    >> Runat="Server">
    >>
    >> AND ..................... </asp:Content>

    >
    > By "wrapped in", I take it that you have removed all of the other <html>
    > tags like <header>, <body> etc from your content pages...?
    >
    Randy Smith, Apr 13, 2007
    #8
  9. Randy Smith

    Randy Smith Guest

    Well,
    I think it's been solved for those interested. Apparently, the following
    code must "live" by itself. I had objects placed within it, but it just
    didn't work. So, the contentplaceholder statements are below the objects.
    <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">

    </asp:contentplaceholder>




    "Randy Smith" <> wrote in message
    news:...
    > Well, I did have the MasterPages in the same folder, then I tried placing
    > the MasterPage in my main website folder, but that didn't seem to make any
    > difference either. Here's what my solution folders look like:
    >
    > /GWO (.NET 2005 solution)
    > /Web
    > - Login aspx.form (redirects to appropriate folder based on
    > user role)
    > /OffSvcs
    > - aspx forms
    > - MasterPage (for Office Services employees)
    > /User
    > - aspx forms
    > - MasterPage (for general users)
    > /AcctUser
    > - aspx forms
    > - MasterPage (for accounting users)
    > /GWO (class libraries and datamappers)
    >
    > TIA, Randy
    >
    >
    >
    >
    >
    > "Mark Rae" <> wrote in message
    > news:...
    >> "Randy Smith" <> wrote in message
    >> news:...
    >>
    >>> I have an existing web site, but now need to add MasterPages. So, I've
    >>> taken existing aspx.pages and added this code:
    >>> MasterPageFile="MasterPage.master"

    >>
    >> So your MasterPage is in the same folder as all your content pages...?
    >>
    >>> I've made sure that my html form elements are wrapped in:
    >>>
    >>> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
    >>> Runat="Server">
    >>>
    >>> AND ..................... </asp:Content>

    >>
    >> By "wrapped in", I take it that you have removed all of the other <html>
    >> tags like <header>, <body> etc from your content pages...?
    >>

    >
    >
    Randy Smith, Apr 14, 2007
    #9
  10. Randy Smith

    Mark Rae Guest

    "Randy Smith" <> wrote in message
    news:%23oLRY$...

    > I think it's been solved for those interested. Apparently, the following
    > code must "live" by itself. I had objects placed within it, but it just
    > didn't work. So, the contentplaceholder statements are below the objects.
    > <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
    >
    > </asp:contentplaceholder>


    That's what I said. Content pages do not have all of the "top and tail" of
    regular pages - their MasterPage provides those...
    Mark Rae, Apr 14, 2007
    #10
    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. Mr Newbie

    Listbox does not appear in Request.Form

    Mr Newbie, Sep 23, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    4,699
    Mr Newbie
    Sep 23, 2005
  2. Nick Wouters
    Replies:
    5
    Views:
    4,634
    Flinky Wisty Pomm
    May 8, 2006
  3. phuile
    Replies:
    1
    Views:
    255
    Gordon Beaton
    Jul 18, 2007
  4. JohnE

    masterpages with masterpages

    JohnE, Dec 7, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    485
    Hillbilly
    Dec 8, 2009
  5. Replies:
    1
    Views:
    105
Loading...

Share This Page