Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can some one explain Master pages and how to use them

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
0
36
US
This is VWD 2008 express
I'm coming from Front Page where everything was visual, now I'm completely lost.
I'm confused as to what's what master vs content and how to create them. which is inside of which.
I made a MasterPage.master with header info that I want to have on each page. I put that in the Default.aspx page and it shows up but I can't add anything to Default.aspx there is NOT mouse pointer.
This is the Default.aspx page
Code:
<%@ Page Language="VB" masterpagefile="MasterPage.master" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<script runat="server">

</script>
I want the top of every page to have our Logo and a drop down menu selections. have a left side with other links, a footer, and the center be changeable, so when you click a menu item at the top the middle changes to that page. Standard stuff right? NOT!!!
This is the MasterPage.master
Code:
<%@ Master Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<script runat="server">
    Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs)
    End Sub
</script>

<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 51px;
        }
        .style3
        {
            width: 138px;
        }
        .style4
        {
            width: 85px;
        }
        .style6
        {
            width: 73px;
        }
        .style7
        {
            width: 95px;
        }
        .style8
        {
            width: 77px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
            <p>
                <img alt="OHC Logo" src="images/OHCLogoDropShadow.jpg" 
                    style="width: 241px; height: 57px" /><table class="style1">
                    <tr>
                        <td class="style2">
                            <asp:Menu ID="Menu1" runat="server" onmenuitemclick="Menu1_MenuItemClick" 
                                style="margin-top: 1px">
                                <Items>
                                    <asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                        <td class="style3">
                            <asp:Menu ID="Menu2" runat="server" style="margin-left: 0px">
                                <Items>
                                    <asp:MenuItem Text="Why Choose OHC  " Value="Why Choose OHC  "></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                        <td class="style4">
                            <asp:Menu ID="Menu3" runat="server">
                                <Items>
                                    <asp:MenuItem Text="Training" Value="Training"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                        <td class="style8">
                            <asp:Menu ID="Menu4" runat="server">
                                <Items>
                                    <asp:MenuItem Text="Services" Value="Services">
                                        <asp:MenuItem Text="Asbestos" Value="Asbestos"></asp:MenuItem>
                                        <asp:MenuItem Text="Air Monitoring" Value="Air Monitoring"></asp:MenuItem>
                                    </asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                        <td class="style6">
                            <asp:Menu ID="Menu5" runat="server">
                                <Items>
                                    <asp:MenuItem Text="News" Value="News"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                        <td class="style7">
                            <asp:Menu ID="Menu6" runat="server">
                                <Items>
                                    <asp:MenuItem Text="Careers" Value="Careers"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                        <td>
                            <asp:Menu ID="Menu7" runat="server">
                                <Items>
                                    <asp:MenuItem Text="Contact Us" Value="Contact Us"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                    </tr>
                </table>
            </p>
        
        </asp:ContentPlaceHolder>
    </div>
    <p style="height: 351px; width: 151px">
        &nbsp;</p>
    </form>
    </body>
</html>


DougP
[r2d2] < I Built one
 
Someone here will probably eventually get you your answer, but most of the ASP.Net questions and answers can be found here:

forum855
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top