I m new in Ajax, I have created a class and want to call its function
from my js.If i make instance of my class in my aspx page and then
return value to the js, it works fine but if i try to call directly
from js, it doesnt work. i have registered my class .
class properties can be accessed successfully but functions cannot be
...I have wriiten following code
My Class
public class MyTestClass
{
private string FName;
private string LName;
public MyTestClass()
{
FName = string.Empty;
LName = string.Empty;
}
public string FirstName
{
set
{
FName =value ;
}
get
{
return FName;
}
}
public string LastName
{
set
{
LName = value;
}
get
{
return LName;
}
}
public string GetName()
{
return FName + "-" + LName;
}
}
now i m calling it in js like
var ts=_Default.GetCls(); (i m returing class object from my aspx page
as direct creation is not working)
ts.FirstName="Sadi";
ts.LastName="Khan";
alert(ts.FirstName + "--" + ts.LastName);
above three lines are working but following line produces no output
ts.GetName(My_callback)
function My_callback(res)
{
alert(res.value);
}
Can anyone tell me what mistake i m doing
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info/
Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---