Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


ASP.net form Validate with JavaScript help!!!



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> ASP & ASP.NET Forum
View previous topic :: View next topic  
Author Message
vargf



Joined: 27 Sep 2006
Posts: 2

PostPosted: Wed Sep 27, 2006 7:13 pm    Post subject: ASP.net form Validate with JavaScript help!!! Reply with quote

Hi to all
I have to Write a method that handles the CustomerValidator's ServerValidate event. In addition, I have to write a JavaScript function for the CustomValidator's CustomValidationFunction property. Each method should verify that the user entered an integer in each text box and that the product of the integers is not a multiple of 7. Display the product of the numbers in the Label control if the numbers entered by the user satisfy the validation tests. The Java script has to be an external file
like myJscript.js

I have the following controls
Button control
two TextBox controls
Label control
CustomValidator control

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript" src="JScript.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtinput1" runat="server" Style="z-index: 100; left: 230px; position: absolute;
top: 70px"></asp:TextBox>
<asp:TextBox ID="txtinput2" runat="server" Style="z-index: 101; left: 231px; position: absolute;
top: 122px"></asp:TextBox>
<asp:Button ID="btnCalculate" runat="server" Style="z-index: 102; left: 128px; position: absolute;
top: 93px" Text="Calculate" />
<asp:Label ID="lblAnswer" runat="server" Height="27px" Style="z-index: 103; left: 232px;
position: absolute; top: 174px" Width="153px"></asp:Label>
&nbsp;&nbsp;
<asp:CustomValidator ID="lblErrorJsInAsp" runat="server"
ControlToValidate="txtinput2" ErrorMessage="Don't devide by 0" Style="z-index: 106;
left: 260px; position: absolute; top: 177px" ClientValidationFunction="Checkinput"></asp:CustomValidator>

</div>
</form>
</body>
</html>

<-----------------External JScript code----------------------->

function Checkinput(oSrc , args)

{
alert(args.Values);
if((args.Values = % 7) == 0)
{
args.IsValid = true;
alert("Modules = 0");
}
else
{
args.IsValid = false;
alert("Module != 0");
}
}
}

The code is in ASP.net 2.0
Can any body help to me. Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> ASP & ASP.NET Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap