Getting a masterpage error in asp.net -
i trying add masterpage in asp.net getting error saying page contains markup not valid when attached masterpage. here masterpage file:
<%@ master language="c#" autoeventwireup="true" codefile="masterpage.master.cs" inherits="pages_adminmaster" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:contentplaceholder id="head" runat="server"> </asp:contentplaceholder> </head> <body> <form id="form1" runat="server"> <div style="text-align: right"> <asp:contentplaceholder id="contentplaceholder1" runat="server"> <asp:linkbutton id="linkbutton1" runat="server" onclick="linkbutton1_click">log out</asp:linkbutton> </asp:contentplaceholder> </div> </form>
and here web form apply masterpage:
<%@ page language="c#" masterpagefile="~/pages/masterpage.master" autoeventwireup="true" codefile="admin.aspx.cs" inherits="pages_admin" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .style1 { text-decoration: underline; color: #0000ff; } .style2 { font-family: 15; font-size: 12pt; color: #0000ff; } </style> </head> <body> <form id="form1" runat="server"> <div class="style2" style="text-align: right"> </div> </form> <p class="style1"> <a href="createcourse.aspx">create new course</a></p> <p class="style1"> <a href="modifycourse.aspx">modify course</a></p> <p class="style1"> <a href="createaccount.aspx">create new account</a></p> <p class="style1"> <a href="deleteaccount.aspx">delete account</a></p> <p class="style1"> <a href="disableaccount.aspx">disable account</a></p> <p class="style1"> <a href="dropstudent.aspx">drop student course</a></p> <p class="style1"> <a href="enrollstudent.aspx">enroll student course</a></p> <p class="style1"> <a href="getstudentinfo.aspx">get student info</a></p> <p class="style1"> <a href="getinstructorinfo.aspx">get instructor info</a></p> </body> </html>
and here error in browser:
server error in '/bannerweb' application. content controls have top-level controls in content page or nested master page references master page. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.web.httpexception: content controls have top-level controls in content page or nested master page references master page. source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [httpexception (0x80004005): content controls have top-level controls in content page or nested master page references master page.] system.web.ui.masterpage.createmaster(templatecontrol owner, httpcontext context, virtualpath masterpagefile, idictionary contenttemplatecollection) +8968123 system.web.ui.page.get_master() +54 system.web.ui.page.applymasterpage() +15 system.web.ui.page.performpreinit() +45 system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +328
both pages in folder named pages. can me this? thanks.
the webform uses master page, need put content within <asp:content contentplaceholderid="contentplaceholder1" runat="server"></asp:content>
maps content displayed @ page within master page.
msdn has more information on how use <asp:contentplaceholder />
on master pages , <asp:content />
@ http://msdn.microsoft.com/en-us/library/wtxbf3hh(v=vs.100).aspx.
Comments
Post a Comment