Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m not able to add button on my master page:-
ASP.NET
<head>
<title>Employee Quotient</title>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
    <link href="Styles/style.css" rel="stylesheet" type="text/css" />
<!--[if lt IE 7]>
  <link rel="stylesheet" href="iefixes.css" type="text/css" />
<![endif]-->
</head>
<body>
<div id="container">
  <div id="header">
    <div id="logo">
      <h1><a href=""><img style="width: 140px; height: 80px;" src="../images/logo.png" alt="" /></a></h1>
    </div>
    <div id="search">
      <div>
          <asp:Label ID="lblUser" runat="server" Text="Label"></asp:Label>
          <asp:Button ID="btnLogout" runat="server" Text="Logout" />          
      </div>
    </div>
  </div>
  <div id="menu">
    <ul>
      <li><a href="">Home</a></li>
      <li><a href="">Report</a></li>
      <li><a href="">Profile</a></li>      
    </ul>
  </div>
  <div class="clear-fix" id="wrapper">
  </div>

  <asp:ContentPlaceHolder ID="cphContent" runat="server" />
  
</div>

I m getting this error "Control 'btnLogout' of type 'Button' must be placed inside a form tag with runat=server. "
Posted
Comments
Sandeep Mewara 3-Jul-12 4:26am    
are you exporting anything to PDF, Word, etc in your code behind?

The error message is pretty explicit: "must be placed inside a form tag with runat=server"

So the solution is in the question, no?

XML
<form id="MyForm" method="post" runat="server">
UI code
</form>
 
Share this answer
 
Comments
AmitGajjar 3-Jul-12 5:20am    
correct... form is missing... 5+
Just Add
EnableEventValidation="false"
in the page tag of aspx page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900