Client-Side Validation?

G

Guest

I want to perform client side validation on click of a ASP.NET web Server
Button Control. How shall i call my javascript function to do that ?

Also i want that the data shall be posted to the server only after
validation is performed. If the validation fails i don't want the page to be
posted back to the server.

Pls help?
 
J

Jeebu

hi,
if there is a textbox and u want to validate by server button here is the code
write a javascript
<script language ='Javascript'>
function ValTxt()
{
if(txt.value=="")
{
alert('value cannot be null');
return false;
}
else
return true;

}
</script>

on the page load of aspx page]

applybtn.Attributes.Add("OnClick","return ValTxt();");
jeebu
 
G

Guest

Thanx for the help.

Jeebu said:
hi,
if there is a textbox and u want to validate by server button here is the code
write a javascript
<script language ='Javascript'>
function ValTxt()
{
if(txt.value=="")
{
alert('value cannot be null');
return false;
}
else
return true;

}
</script>

on the page load of aspx page]

applybtn.Attributes.Add("OnClick","return ValTxt();");
jeebu

Saket Mundra said:
I want to perform client side validation on click of a ASP.NET web Server
Button Control. How shall i call my javascript function to do that ?

Also i want that the data shall be posted to the server only after
validation is performed. If the validation fails i don't want the page to be
posted back to the server.

Pls help?
 

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

Top