范围验证器工作奇怪

时间:2017-06-27 12:53:42

标签: asp.net vb.net

我遇到一个奇怪的问题,验证器是在后面的代码中构建的。当产品具有最小订货量时,我用它来限制文本框的输入。

Dim oQtyBoxValidation As RangeValidator
oQtyBoxValidation = New WebControls.RangeValidator
oQtyBoxValidation.ID = "qtyBoxValidation_" & Trim(oDataRow("pno"))
oQtyBoxValidation.ControlToValidate = Trim(oDataRow("pno"))
oQtyBoxValidation.ValidationGroup = "vg_" & Trim(oDataRow("pno))

'if min_order_qty set 
If Convert.ToDouble(Trim(oDataRow("min_order"))) > 1 Then
    oQtyBoxValidation.MinimumValue = Convert.ToDouble(Trim(oDataRow("min_order")))
    oQtyBoxValidation.Text = "Quantity must be " & Convert.ToDouble(Trim(oDataRow("min_order"))) & " to 9999"
Else
    oQtyBoxValidation.MinimumValue = "1"
    oQtyBoxValidation.Text = "Quantity must be 1 to 9999"
End If

但是,如果我在验证器中输入qtys 23,2,12-22号码,它会起作用,但如果我输入3-9,验证信息将不会显示。

0 个答案:

没有答案