.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 13th, 2003, 09:07 AM
calinberindea calinberindea is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 18 calinberindea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RangeValidator

I want to use a integer range validator for a text box, but I want to set the maximum value at the end of Page_Load rutine, because it's the moment I know it's value.<br><br>How can I do this?

Reply With Quote
  #2  
Old May 13th, 2003, 09:58 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
Assuming that the name of the validator is "RangeValidator1":<br><br>Set the RangeValidator1's "type" property to "Integer". Then try adding this to the page load routine"<br><br>int x = 200; // or whatever number you set x to be<br>RangeValidator1.MaximumValue = x.ToString();<br><br>Hope this helps.<!-- Edit --><p><i>Last Edited : 5/13/2003 7:00:28 PM GMT</i></p>

Reply With Quote
  #3  
Old May 14th, 2003, 09:45 AM
calinberindea calinberindea is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 18 calinberindea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If I don't provide in the aspx a value for MaximumValue attribute I get the following exception:<br><br>Exception Details: System.Web.HttpException: The value '' of the MaximumValue property of 'IssuesRangeValidator' cannot be converted to type 'Integer'<br><br>If I set the MaximumValue to let's say 100 in the aspx, and in the code behind page to 50, it uses 100 to validate my control.<br> <img border="0" src="/forum/emoticons/mad.gif" height="15" width="15" alt="mad" />

Reply With Quote
  #4  
Old May 14th, 2003, 06:30 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
The exception is appearing because the MaximumValue has to be a string. (but it can still validate the string as a number)<br><br>Follow these steps:<br><br>1) Clear out the Max and Min values in the ASPX to 0 - for the range validator. <br>2) In the ASPX, set the type property to "Integer".<br>3) Type in this code in the PageLoad()<br><br>RangeValidator1.MinimumValue = "1";<br>RangeValidator1.MaximumValue = "100";<br><br>This works on my system. Hope it works for you, Danny

Reply With Quote
  #5  
Old May 15th, 2003, 09:03 AM
calinberindea calinberindea is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 18 calinberindea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Nice!!! <br>Now when I tried to submit this message and I get a exception error on the forum <br> <img border="0" src="/forum/emoticons/tongue.gif" height="15" width="15" alt="tongue" /> <br><br>Seems that not only I have problems with the .NET

Reply With Quote
  #6  
Old May 15th, 2003, 09:16 AM
calinberindea calinberindea is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 18 calinberindea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still not working!<br><br>My code-behing source in page load is (VB.NET):<br><br> IssuesRangeValidator.Type = ValidationDataType.Integer<br> IssuesRangeValidator.MinimumValue = "1"<br> IssuesRangeValidator.MaximumValue = "50"<br><br>In the aspx file I have the following:<br><br> <div class="msgQuoteWrap"><div class="msgCode">asp:RangeValidator runat="server" ID="IssuesRangeValidator" ControlToValidate="txtPage" ForeColor="#cc0033" ErrorMessage="Value is out of range!"</div></div><br><br><br><br>I don't get any error, but oon any value I get the message "Value is out of range!" (I tryed 1, 50, 100, 100, 4)<br><br> <img border="0" src="/forum/emoticons/mad.gif" height="15" width="15" alt="mad" /> <br><br>Nice!!! <br>Now when I tried to submit this message and I get a exception error on the forum <br> <img border="0" src="/forum/emoticons/tongue.gif" height="15" width="15" alt="tongue" /> <br><br>Seems that not only I have problems with the .NET

Reply With Quote
  #7  
Old May 15th, 2003, 05:41 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
Hmm... If you give me your email, I will send you my working example. It's in C#, but should work the same.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > RangeValidator


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT