Hi evrery one!
I have this code in my project:
var UI =
{
Layouts:
{
ShowLayoutSettings: function(pid, lid) {
My.PageServices.GetPageLayout(lid, pid, UI.Layouts._onShowLayoutSettings);
},
_onShowLayoutSettings: function(obj) {
alert(obj.ID);
}
}
}
and in my asp.net project a web service named PageServices:
namespace My
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class PageServices : System.Web.Services.WebService
{
public PageServices()
{
}
[WebMethod]
[ScriptMethod(UseHttpGet = false, XmlSerializeString = true)]
[GenerateScriptType(typeof(PageLayout))]
public PageLayout GetPageLayout(string lid, int pid)
{
if (!SystemModel.UserManager.HasLogin())
return null;
var o = SystemModel.Layouts.GetPageLayout(pid);
o.Tag = lid;
return o;
}
}
}
I should mention that my PageLayout class is a linq class and it's serialization mode is Unidirectional.
and finally a anchor link:
<a href="#" onclick="UI.Layouts.ShowLayoutSettings(5,2);">Test</a>
My problem is it is correct and sends ajax request to my service when I click this link and my service returns the object as needed, but it does not fire _onShowLayoutSettings as the call back function for this request.
I tested this work when I create a web servive which just returns and String object, and it was all correct, but I don't know why for my PageLayout object, it's not correct.
Please help me. Thank you.