webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="work036.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>验证控件</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="1">
            <tr>
                <td>用户名</td>
                <td>
                    <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="valiUserName" runat="server" ErrorMessage="请填用户名" ControlToValidate="txtUserName"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>省份</td>
                <td>
                    <asp:DropDownList ID="ddlProvince" runat="server">
                    <asp:ListItem Selected="True">请选择</asp:ListItem>
                    <asp:ListItem Value="1">新疆</asp:ListItem>
                    <asp:ListItem Value="2">内蒙古</asp:ListItem>
                    <asp:ListItem Value="3">青海</asp:ListItem>
                    <asp:ListItem Value="4">西藏</asp:ListItem>
                    <asp:ListItem Value="5">甘肃</asp:ListItem>
                    <asp:ListItem Value="6">浙江</asp:ListItem>
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="valiProvince" runat="server" ErrorMessage="请选择省份" ControlToValidate="ddlProvince" InitialValue="请选择"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="Button1" runat="server" Text="提交" />
                </td>
                <td></td>
            </tr>
        </table>

    </div>
    </form>
</body>
</html>

webform1.asxp.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace work036
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
        }
    }
}