Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to write a javascript file to validate text field in asp page?
Posted
Comments
[no name] 25-Nov-11 4:27am    
how do you want the text field to be validated?

Try using jQuery:

XML
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  var textbox = document.getElementById('<%= TEXTBOX.ClientID %>');
  var button = document.getElementById('<%= SEND.ClientID %>');
  $(SEND).click(function() {
    // do validation here
  });
});
</script>


the SEND above is an asp.net button control. The logic here is to validate the textbox upon clicking the SEND button. Try studying jQuery. Its easier than javascript

For your reference:
http://www.w3schools.com/jquery/default.asp

Best regards,
Eduard
 
Share this answer
 
Comments
riodejenris 25-Nov-11 7:09am    
so how can i access this javascript file in asp page?
Hi try this one

http://forums.asp.net/t/1115953.aspx/1[^]


hope it helps!
 
Share this answer
 
Lots of possibilities here[^].
 
Share this answer
 
 
Share this answer
 

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