Does anyone know there have any way that I can set the minimumvalue and the maximumvalue in the server side for asp:RangeValidator .net c#
Example:
I have the following code, instead of hard coding the minimumvalue and the maximumvalue, any way that I can set those value during the page load?
<asp:RangeValidator runat="server" id="rngDate" controltovalidate="txtDate" type="Date" minimumvalue="01-01-2011" maximumvalue="26-05-2011" errormessage="Please enter a valid date !" />
Yes, just set the
MinimumValueandMaximumValueproperties in thePage_Load. First, change your declaration ofmaximumvaluein your sample code tomaximumvalue="05-26-2011"(the way you have it in the sample caused an ASP.NET exception in my test). Then, just do something like this in thePage_Load:It should work fine. If it’s not, then maybe something else is going on in your page.