如何检查验证组 [英] how to check validation group

查看:62
本文介绍了如何检查验证组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查验证组?
我有一个表单,其中有50个文本框,然后单击按钮,然后此页面验证false如何检查验证组中哪个文本框为空白.

how to check validation group ?
i have a form in which 50 textbox whin i click button then this page validate false how to check which textbox is blank in validation group.

Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports .DBUtility
Imports System.Collections.Generic





Public Function getColorCode(ByVal obj As CColorName, ByVal startIndex As Int16, _
                            ByVal endIndex As Int16, ByRef totalRecords As Int16, ByVal TRecords As Boolean, ByVal strCheckColorList As String)As List(Of CColorName)
        Dim objlst As New List(Of CColorName)()
        Dim reader As SqlDataReader
        Try
            If TRecords = True Then
                Dim param As SqlParameter() = New SqlParameter() {New SqlParameter("@ColorID", obj.ColorID), _                                                                                                                                   
                                                                  New SqlParameter("@Color", strCheckColorList) }
                                                           
                reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringRage_RMS, Data.CommandType.StoredProcedure, "dbo.vs_Color_SELECT_TR", param)
                If (reader.Read) Then
                    totalRecords = reader(0)
                End If
                Dim sqlParams As SqlParameter() = New SqlParameter() {New SqlParameter("@ColorId", obj.ColorId), _                                                                      
                                                                      New SqlParameter("@Color", strCheckColorList), _                                                                   
                                                                      New SqlParameter("@startIndex", startIndex), _
                                                                      New SqlParameter("@endIndex", IIf(endIndex = 0, Integer.MaxValue, endIndex))}
                reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringRage_RMS, Data.CommandType.StoredProcedure, "dbo.vs_Color_SELECT_PAGING", sqlParams)
            Else
                Dim sqlParam As SqlParameter() = New SqlParameter() {New SqlParameter("@ColorID", obj.ColorId), _                                                                  
                                                                      New SqlParameter("@Color", strCheckColorList)}
                reader = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringRage_RMS, Data.CommandType.StoredProcedure, "dbo.vs_Color_SELECT", sqlParam)
            End If
            While reader.Read
                Dim objC As New CColorName
                If Not IsDBNull(reader("CModelID")) Then objC.ModelID = reader("CModelID")
              objlst.Add(objC)
            End While
            Return objlst
        Catch ex As Exception
            Logs.WriteErrorLog("DBColor.vb | getColorCode " + ex.Message)
            Return objlst
        Finally
            objlst = Nothing
            reader = Nothing
        End Try

    End Function

推荐答案

验证组可帮助您将控件分组在单个页面中.以下示例将帮助您实现这一目标:
http://msdn.microsoft.com/en-us/library/ms227424 (v = vs.100).aspx [ http://www.dotnet-guide.com/validationgroups.html [
The validation groups help you to group the controls in a single page. Following examples will help you implement that:
http://msdn.microsoft.com/en-us/library/ms227424(v=vs.100).aspx[^]
http://www.dotnet-guide.com/validationgroups.html[^]


Hello Dinesh,

您可以使用下面的代码片段来验证哪些验证已失败

this.Validators.Where(v =>!v.IsValid


Hello Dinesh,

You can use below snipet to validate which validation is pfailed

this.Validators.Where(v => !v.IsValid


Please let us know if any.


set应该将所有文本框和按钮的validationGroup属性设置为相同.
set should set validationGroup Property same for all textbox and button .


这篇关于如何检查验证组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆