I'm using AJAX.NET and C# ASP.NET
My Soldier class is a type of Person class.
[WebMethod, ScriptMethod]
public static Person getPerson(int personId)
{
return (Person)personService.getSoldier(personId);
}
This works perfectly well. On the Ajax side, I can get and set the Soldier properties. However, when I send this object back, I can't convert it back to a Soldier object.
[WebMethod, ScriptMethod]
public static Person savePerson(Person person)
{
Soldier soldier = (Soldier)person;
}
This fails. It says it can't convert object Person to Soldier. Is there a way around this because I don't want to create a dozen of save methods for every type? Any help from you would be greatly appreciated.
what you can do is that.