How get RangeValidator to work when bounds are from databind

C

COHENMARVIN

I'm trying to get a rangevalidator to work. Normally this is easy, but
here I'm trying to make the rangevalidator check a range that is from
variables.
Here is the code. Its simple, but it doesn't work. Any help is
appreciated.

<ASP:TextBox id="Kings" Text="0" Columns="4" MaxLength="4"
runat="server" />

<ASP:RangeValidator id="KingsRange" runat="server"
ControlToValidate = "Kings"
MaximumValue = <%# gKingsLeft %>
MinimumValue=<%# gMinimumKings %>
Type = "Integer"
ErrorMessage="The number of kings must be between " & <%#
gMinimumKings %> & " and " _
& <%# gKingsLeft %>
Display = "dynamic">
*
</ASP:RangeValidator>
 
P

Peter Blum

In this case:
1. Confirm that you are calling DataBind() on KingsRange.
2. Make sure gKingsLeft and gMinimumKings is a string or convert it to
string in the ErrorMessage:
ErrorMessage="The number of kings must be between " & <%#
gMinimumKings.ToString() %> & " and " _
& <%# gKingsLeft.ToString() %>

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top