错误消息 - 类型“按钮”必须放在主页中具有runat = server的表单标记内。 [英] Error message- Type 'Button' must be placed inside a form tag with runat=server in master page.

查看:95
本文介绍了错误消息 - 类型“按钮”必须放在主页中具有runat = server的表单标记内。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在母版页上添加按钮: -

 <   head  >  
< title > 员工商数< / title >
< < span class =code-leadattribute> meta content = text / html; charset = ISO-8859-1 < span class =code-attribute> http-equiv = content-type / > ;
< link href = 样式/ style.css rel = stylesheet type = text / css / >
<! - [if lt IE 7]>
< link rel =stylesheethref =iefixes.csstype =text / css/>
<![endif]
- >

< / head >
< 正文 >
< div id = 容器 >
< div id = header >
< div id = logo >
< h1 > < a href = > < img style = width:140px;高度:80px; src = ../ images / logo.png alt = / > < / a > < / h1 >
< / div >
< div id = 搜索 >
< div >
< asp:标签 ID = lblUser runat = server 文本 = 标签 > < / asp:Label >
< asp:按钮 ID = btnLogout runat = server 文字 = 退出 / >
< / div >
< / div >
< / div >
< div < span class =code-attribute>
id = menu >
< ul >
< li > < a href = > 主页< / a > < / li >
< li > < a href = > 报告< / a > < / li >
< li > < a href = > 个人资料< / a > < / li >
< / ul >
< / div >
< div class = clear-fix id = wrappe r >
< / div >

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

< / div >



我收到此错误类型'Button'的控件'btnLogout'必须放在带有runat = server的表单标签内。

解决方案

错误消息非常明确:必须放在带有runat = server的表单标签内



所以解决方案就在问题中,不是吗?



 <  表格    id   =  MyForm   方法  =  post    runat   = 服务器 >  
用户界面代码
< / form >


< blockquote>在aspx页面的页面标签中添加

 EnableEventValidation =false


i m not able to add button on my master page:-

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

解决方案

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

So the solution is in the question, no?

<form id="MyForm" method="post" runat="server">
UI code
</form>


Just Add

EnableEventValidation="false"

in the page tag of aspx page.


这篇关于错误消息 - 类型“按钮”必须放在主页中具有runat = server的表单标记内。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆