paddytakate
12-19-2007, 11:54 AM
Hi,
I've created one small example using AJAX-Enabled Web site template. Put the below code. The registerClass method gives error saying that typeName is not defined.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<%--<script src="JScript.js" type="text/javascript" language="javascript" />--%>
<script type="text/javascript" language="javascript">
function pageLoad()
{
Type.registerNamespace("iConnect");
iConnect.Person=function(fname,lname)
{
var _fname=(fname!=null)?fname:"unknown";
var _lname=(lname!=null)?lname:"unknown";
this.getFullName=function()
{
var st=this._fname+" "+this._lname;
return st;
}
this.setFName=function(fname)
{
this._fname=fname;
}
this.setLName=function(lname)
{
this._lname=lname;
}
}
Type.registerClass("iConnect.Person");
var p=new iConnect.Person("Great","India");
debugger;
var s=p.getFullName();
document.getElementById("output").innerText=s;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" >
</asp:ScriptManager>
<div id="output">
</div>
</form>
</body>
</html>
--->
I can not find what went wrong. Line 33 I changed to "iConnect.Person.registerClass("iConnect.Person"). It registered the class but the o/p is saying "undefined undefine" which is not a desired output. Please guide.
I've created one small example using AJAX-Enabled Web site template. Put the below code. The registerClass method gives error saying that typeName is not defined.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<%--<script src="JScript.js" type="text/javascript" language="javascript" />--%>
<script type="text/javascript" language="javascript">
function pageLoad()
{
Type.registerNamespace("iConnect");
iConnect.Person=function(fname,lname)
{
var _fname=(fname!=null)?fname:"unknown";
var _lname=(lname!=null)?lname:"unknown";
this.getFullName=function()
{
var st=this._fname+" "+this._lname;
return st;
}
this.setFName=function(fname)
{
this._fname=fname;
}
this.setLName=function(lname)
{
this._lname=lname;
}
}
Type.registerClass("iConnect.Person");
var p=new iConnect.Person("Great","India");
debugger;
var s=p.getFullName();
document.getElementById("output").innerText=s;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" >
</asp:ScriptManager>
<div id="output">
</div>
</form>
</body>
</html>
--->
I can not find what went wrong. Line 33 I changed to "iConnect.Person.registerClass("iConnect.Person"). It registered the class but the o/p is saying "undefined undefine" which is not a desired output. Please guide.