页面方法未定义
我有一个带有 MasterPage 的页面,在母版页中,我有这个:
<ajaxToolkit:ToolkitScriptManager ID="scriptManager"
runat="server"
AsyncPostBackTimeout="99999999"
EnablePageMethods="true" />
我在后面的代码中有这个方法:
[WebMethod]
public void SavePreference(string graphVersion)
{
//some code here
}
然后我有这个 javascript 函数:
function lnkLearnHardWayclick(){
if( $("#chkDontShowAgain").attr("checked") == "checked")
{
PageMethods.SavePreference('new');
}
$("#info").hide();
$("#hardWay").show();
}
但是当我单击链接以使一切正常工作时,我得到了这个错误:
未捕获的引用错误:PageMethods 未定义
I have a page with a MasterPage, in the master page, I have this:
<ajaxToolkit:ToolkitScriptManager ID="scriptManager"
runat="server"
AsyncPostBackTimeout="99999999"
EnablePageMethods="true" />
And I have this method in the code behind:
[WebMethod]
public void SavePreference(string graphVersion)
{
//some code here
}
And then I have this javascript function:
function lnkLearnHardWayclick(){
if( $("#chkDontShowAgain").attr("checked") == "checked")
{
PageMethods.SavePreference('new');
}
$("#info").hide();
$("#hardWay").show();
}
But when I click on the link to make everything work, I get this error:
Uncaught ReferenceError: PageMethods is not defined
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
母版页和用户控件不支持
PageMethods
。PageMethods
are not supported in master pages and user controls.