S
saurabh
Hey i created a simple page to chk the custom validation control....It
checks if the number is prime or not....I get the following error whn i
run it
A Runtime Error has occured.Do you wish to debug ? line25 error:syntax
error
and whn i debug it i get : Microsoft JScript runtime error: Object
expected
can anybody tell me what could be the error...Here is my small piece of
code...
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="javacheck.ascx.cs" Inherits="javacheck.javacheck"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<script language="javascript">
<!--
function CheckPrime(sender, args)
{
var iPrime = parseInt(args.Value);
var iSqrt = parseInt(Math.sqrt(iPrime));
for (var iLoop=2; iLoop<=iSqrt; iLoop++)
if (iPrime % iLoop == 0)
{
args.IsValid = false;
return;
}
args.IsValid = true;
//-->
</script>
<P>
Trying to learn JavaScript</P>
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:CustomValidator id="CustomValidator1" runat="server"
ErrorMessage="CustomValidator" ControlToValidate="TextBox1"
ClientValidationFunction="CheckPrime">Number is not
prime</asp:CustomValidator></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
<asp:Label id="Label1" runat="server">Label</asp:Label></P>
checks if the number is prime or not....I get the following error whn i
run it
A Runtime Error has occured.Do you wish to debug ? line25 error:syntax
error
and whn i debug it i get : Microsoft JScript runtime error: Object
expected
can anybody tell me what could be the error...Here is my small piece of
code...
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="javacheck.ascx.cs" Inherits="javacheck.javacheck"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<script language="javascript">
<!--
function CheckPrime(sender, args)
{
var iPrime = parseInt(args.Value);
var iSqrt = parseInt(Math.sqrt(iPrime));
for (var iLoop=2; iLoop<=iSqrt; iLoop++)
if (iPrime % iLoop == 0)
{
args.IsValid = false;
return;
}
args.IsValid = true;
//-->
</script>
<P>
Trying to learn JavaScript</P>
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:CustomValidator id="CustomValidator1" runat="server"
ErrorMessage="CustomValidator" ControlToValidate="TextBox1"
ClientValidationFunction="CheckPrime">Number is not
prime</asp:CustomValidator></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
<asp:Label id="Label1" runat="server">Label</asp:Label></P>