however my question is simple but I don't know it's answer. I use range validators in my project. I know how they work for integer or float or dates but I don't know how they works for strings. for example if the min value is "xx" and the max value is "zzyyyz" ,what the users can enter? can you get me an example?

有帮助吗?

解决方案

If you look at the documentation of the RangeValidator, it appears you can specify a string type:

<asp:RangeValidator runat="server"
                    MaximumValue="zz"
                    MinimumValue="xx" 
                    Type="String" 
                    ... />

Although you may be better off using a RegularExpressionValidator. In this example, you'd have:

<asp:RegularExpressionValidator runat="server"
                                ValidationExpression="^[x-z]{2}$"
                                ... />
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top