~~~~ Master Page ASP.net~~~~

Discussion in 'ASP' started by hasmukh, Jul 31, 2006.

  1. hasmukh

    hasmukh New Member

    Joined:
    Jul 31, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    i m using asp.net 2.0 and trying to include master page in my project but whenever i save a file with .master extension and include it in my aspx page i get an error message unknown file extension. I m using text editor to build my web page.

    Help required !!!

    Thanks in Advance


    :) HASMUKH :)
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Checkout a working example, and try to figure out what's wrong with your code.

    Code:
    <%@ master language="C#" %>
       <script runat="server" language="c#">
    //MASTER FILE
       </script>
       
       <html>
       <head id="Head1" runat="server">
           <title>Master Page
       </head>
       <body>
           <form id="Form1" runat="server">
               <table id="header" style="WIDTH: 100%; HEIGHT: 80px" cellspacing="1" cellpadding="1" border="1">
                   <tr>
                       <td width="100%" style="TEXT-ALIGN: center">
                           This is the header from the Master Page
                       </td>
                   </tr>
               </table>
               <b/>
                <table id="leftNav" style="WIDTH: 108px; HEIGHT: 100%" cellspacing="1" cellpadding="1" border="1">
                   <tr>
                       <td style="WIDTH: 100px"> Left Navigation
                       </td>
                   </tr>
                   </table>                                 
               <table id="mainBody" style="LEFT: 120px; VERTICAL-ALIGN: top; WIDTH: 848px; POSITION: absolute; TOP: 94px; HEIGHT: 100%" border="1">
                   <tr>
                       <td width="100%" style="VERTICAL-ALIGN: top">                
                           <asp:contentplaceholder id="middleContent" runat="Server">                
                       </td>
                   </tr>
               </table>
           </form>
       </body>
       </html>
    Code:
    <%@ page language="C#" master="~/Intro.master" %>
       <script runat="server">
    //ASPX FILE
           
           void Page_Load(object sender, System.EventArgs e)
           {
               lblMessage.Text = "This content is generated from the content page";
           }
           
       </script>
       
       <asp:content id="Content1" contentplaceholderid="middleContent" runat="server">
           <asp:label runat="server" id="lblMessage">  
       </asp:content>
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice