嗨,大家好,我试图使用ToolkitScriptManager从CS获取数据到JS。 这是我的aspx:ASP.net PageMethods返回undefined
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../assets/lib/jquery/jquery-2.0.3.js" type="text/javascript"></script>
<script>
$(window).load(function() {
alert(PageMethods.isConnected());
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager runat="Server"
EnablePageMethods="true"
EnablePartialRendering="true" />
<div>
</div>
</form>
</body>
</html>
,这背后是
[ScriptMethod, WebMethod]
public static bool isConnected()
{
return true;
}
我不知道我的代码,但这种保留的结果不确定的,对不起,如果这是真的对你简单的问题,但对我来说如此努力,因为我是新的在asp.net 请帮我解决这个问题。
看看这个:http://forums.asp.net/t/993893.aspx –