要在Devexpress ASPX GRIDVIEW里面做这样一个验证
PV1 contact
PV2 contact      PV2 Product (注:PV contact是下拉列表)
第一。如果PV2 contact不为空,PV1 contact也不能为空。。但如果PV2 contact为空 PV1 contact也可以为空。
第二。PV2 CONTACT 和PV2 PRODUCT 可以同时为空,但是不能一个为空一个不为空
第三。如果PV2 CONTACT 和PV2 PRODUCT  都不为空的时候开始判断PV2 PRODUCT
PV2 PRODUCT TEXTBOX里面的数据是用逗号隔开的,比如a,b,c  然后开始验证A在数据库有没有这个数据,B有没有,C有没有
PV2 PRODUCT 拆分成字符串数组,对字符串数组中的每一个字符串和类GETALLPRODUCT开始匹配,如果不同就报错。。
类getAllProduct
 public String[] getAllProducts()
    {
        DataSet dsProducts = rd.GetProductList("%");
        int len = dsProducts.Tables[0].Rows.Count;
        String[] AllProducts = new String[len-3];
        int i = 0;
        for (int n = 0; n < len; n++)
        {
            if (dsProducts.Tables[0].Rows[n]["Product"].ToString() != "All Product" && dsProducts.Tables[0].Rows[n]["Product"].ToString() != "Map Maker" && dsProducts.Tables[0].Rows[n]["Product"].ToString() != "Mobile Maps")
            {
                AllProducts[i] = dsProducts.Tables[0].Rows[n]["ProductLine"].ToString();
                i++;
            }
        }
        AllProducts[i++] = "Map Maker";
        AllProducts[i++] = "Mobile Maps";
        return AllProducts;
    }
Devexpress GRIDVIEW前台代码
<Column> <dxwgv:GridViewDataTextColumn Caption="PV1, contact list" FieldName="ContactorEmail"
                VisibleIndex="6">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn Caption="PV2, contact list" FieldName="Pv2ContactList"
                VisibleIndex="7">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn Caption="PV2, products" FieldName="Pv2Product" VisibleIndex="8">
            </dxwgv:GridViewDataTextColumn>
</Column>这是验证PV2 Product的长度不能超过2个字符的一个例子。。!protected void grid_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
    {  
       
        
        if (e.NewValues["Pv2Product"] != null && e.NewValues["Pv2Product"].ToString().Length < 2)
        {
            AddError(e.Errors, grid.Columns["Pv2Product"], "PV2, products must be at least two characters long.");
        }
不知道有没有大虾会做。