我有一个带有MasterPage的页面,在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未定义
.aspx.cs
文件中。 - Chamika Sandamal