Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have 2 textboxes..i enter value in first textbox,when i try to insert value in textbox2 that time message should come value should less than first textbox....mns i want to do validation of this textboxes...but showing message.......bt i want to show msg in popup format.....give me javacript function for this.......
Posted
Updated 22-Oct-12 21:55pm
v3
Comments
[no name] 23-Oct-12 2:44am    
what you have done so far ....
Street Racers 23-Oct-12 2:56am    
windows or web application?
Member 9027346 23-Oct-12 2:58am    
web application

Try following, perfectly working..

XML
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br />
       <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox><br />
       <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox4"
           ControlToValidate="TextBox5" ErrorMessage="value should less than first textbox"
           Operator="LessThanEqual" Type="Integer"></asp:CompareValidator>


Thanks
 
Share this answer
 
Comments
[no name] 23-Oct-12 3:20am    
my 5
AshishChaudha 23-Oct-12 3:42am    
The one who is downvoting the solution may be perfect dumb. Please verify the reason for downvoting.
fjdiewornncalwe 23-Oct-12 14:24pm    
+5.
 
Share this answer
 
Comments
[no name] 23-Oct-12 3:21am    
nice links
Ambesha 23-Oct-12 3:23am    
Thanks :)
The 'CompareValidator' will solve your issue.
1) add the 'CompareValidator'
2) Set the following properties
2.1) ControlToCompare->textbox1
2.2) ControlToValidate-> textbox2
2.3) ErrorMessage-> Your Message goes here
2.4) Operator-> Less than
2.5) SetFocusonError->true
2.6) type-> String/Integet/Date

Note: this is will work only on 'LostFocus' not while inserting into the textbox(if you want you need to use the javascript).
 
Share this answer
 
Comments
[no name] 23-Oct-12 3:20am    
my 5
Member 9027346 23-Oct-12 3:27am    
thanks for giving this solution but i want another solution when i will insert value into 2nd textbox .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900