【发布时间】:2014-10-29 12:31:06
【问题描述】:
我在验证空文本框时遇到问题
我的文本框
<asp:TextBox ID="TextBox1" runat="server" MaxLength="50" Width="272px" AutoCompleteType="Disabled">
我的标签
<asp:Label ID="warning" runat="server" Text="you forgot about this" ForeColor="Red" Visible="false"></asp:Label>
我的验证
if (TextBox1.Text == "")
{
warning.Visible = true;
}
它可以验证空文本框但它不能验证空格输入
有人可以帮帮我吗?
【问题讨论】:
-
为什么不使用 ASP.NET 验证器控件?
标签: c# asp.net validation