【发布时间】:2011-02-11 01:32:08
【问题描述】:
这是一个非常简单的问题,因为我是 asp.net 的新手,我正在尝试开发与我们联系的页面,但出现以下错误。
“'TextBox' 类型的控件'ContentPlaceHolder1_nameBox' 必须放置在带有runat=server 的表单标签内”
以下是我目前对该页面的代码。
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ContactUs.aspx.cs" Inherits="Craigavon_Aquatics.ContactUs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<h2>
Contact Us</h2>
<p>
Please fill in the form below to contact us.</p>
<p>
</p>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table style="width: 100%">
<tr>
<td>
Name: (Required)</td>
</tr>
<tr>
<td>
<asp:TextBox ID="nameBox" runat="server" Width="278px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Email: (Required)</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</asp:Content>
【问题讨论】: