Using aspnet range validator on html input control
-
19-09-2019 - |
Question
I am building a small web application in c#. I am using the range validator and I want to bind it to an html control that has the runat="server" attribute to it.
From some reason it won't bind and won't perform any check for the content of the control. Does any of you have an idea what to do?
Solution
Based on this link from MSDN it should work
<td>
<asp:RangeValidator id="id" runat="server" ErrorMessage="not 2"
ControlToValidate="txtbx_value" MaximumValue="3" MinimumValue="1"
Type="Integer"> </asp:RangeValidator>
</td>
<td>User ID:</td>
<td><input type=text runat=server id=txtbx_value></td>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow