Проверка заполнения полей формы
есть форма вида:
Код:
<h3>Обратная связь</h3>
<table>
<tr style="display:none;">
<td></td>
<td><asp:TextBox size="30" runat="server" ID="SubjectTextBox" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray" /></td>
</tr>
<tr>
<td>Тема:</td>
<td valign="top"><asp:TextBox size="30" runat="server" ID="TopicTextBox" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray" /></td>
</tr>
<tr>
<td>Е-mail:</td>
<td valign="top" ><asp:TextBox size="30" runat="server" ID="ЕmailTextBox" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray"/></td>
</tr>
<tr>
<td>Текст сообщения:</td>
<td valign="top" >
<asp:TextBox Rows="10" runat="server" ID="MessageTextBox" Columns="50" TextMode="MultiLine" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray"/>
</td>
</tr>
<tr>
<td valign="top"></td>
<td valign="top"><asp:Button runat="server" ID="SendButton" Text="Отправить" OnClick="SendButton_Click" /></td>
</tr>
</table>
<table>
<tr style="display:none;">
<td></td>
<td><asp:TextBox size="30" runat="server" ID="SubjectTextBox" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray" /></td>
</tr>
<tr>
<td>Тема:</td>
<td valign="top"><asp:TextBox size="30" runat="server" ID="TopicTextBox" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray" /></td>
</tr>
<tr>
<td>Е-mail:</td>
<td valign="top" ><asp:TextBox size="30" runat="server" ID="ЕmailTextBox" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray"/></td>
</tr>
<tr>
<td>Текст сообщения:</td>
<td valign="top" >
<asp:TextBox Rows="10" runat="server" ID="MessageTextBox" Columns="50" TextMode="MultiLine" Width="132px" style="padding: 2px; margin: 0; border: 1px solid gray"/>
</td>
</tr>
<tr>
<td valign="top"></td>
<td valign="top"><asp:Button runat="server" ID="SendButton" Text="Отправить" OnClick="SendButton_Click" /></td>
</tr>
</table>
почитал документацию
Код:
<asp:TextBox runat="server" Width="200px" ID="Name" />
<asp:RequiredFieldValidator runat="server" ID="ValidateName" ControlToValidate="Name"
ErrorMessage="Имя пустое" Display="dynamic">*
</asp:RequiredFieldValidator>
<asp:RequiredFieldValidator runat="server" ID="ValidateName" ControlToValidate="Name"
ErrorMessage="Имя пустое" Display="dynamic">*
</asp:RequiredFieldValidator>