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

R

Randy Smith

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
 
M

Mark Rae

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"...?
 
G

George Ter-Saakov

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
 
B

bpd

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" %>
 
R

Randy Smith

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
 
M

Mark Rae

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...?
 
R

Randy Smith

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
 
R

Randy Smith

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>
 
M

Mark Rae

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...
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top