AJax错误"WebForm1"没有定义的javascript错误的解决方法
2005-11-28 09:31
741 查看
笔者在研究QuickGuide.txt的文章同时,按照顺序一步步的做法,结果运行时,发现老是出现这样的错误 ,"WebForm1"没有定义的javascript错误,换了以该项目为根目录,错误照旧
使用google在网络里查询,结果发现很多朋友也发生同样的错误.
于是产生欢迎该dll是否download的不正确. 但是照着文档资料查询了一下
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1));
}
这里设置后,web里面会产生代码
<script type="text/javascript" src="/ajax/common.ashx"></script>
<script type="text/javascript" src="/ajax/AJAX_Test.WebForm1,AJAX_Test.ashx"></script>
这证明dll能够发生作用,也就是说该dll能正常运行.到底错误怎么产生的呢??
根据
The call to RegisterTypeForAjax emits the following JavaScript on the page (alternatively, you could manually place the following two lines on the page):
Where the bolded parts have the following meaning:
发现该产生的code 必须是ajax/为根的,所以按照上面描述,人工加上一段code在aspx文件里
<script type="text/javascript" src="ajax/common.ashx"></script>
<script type="text/javascript" src="ajax/AJAX_Test.WebForm1,AJAX_Test.ashx"></script>
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
// Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1)); 注销这段代码
}
结果运行正确.
得到的结论是,可能是该ajax的一个小Bug,产生的js代码不对.但是可以根据上述的规则人为添加js代码
使用google在网络里查询,结果发现很多朋友也发生同样的错误.
于是产生欢迎该dll是否download的不正确. 但是照着文档资料查询了一下
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1));
}
这里设置后,web里面会产生代码
<script type="text/javascript" src="/ajax/common.ashx"></script>
<script type="text/javascript" src="/ajax/AJAX_Test.WebForm1,AJAX_Test.ashx"></script>
这证明dll能够发生作用,也就是说该dll能正常运行.到底错误怎么产生的呢??
根据
The call to RegisterTypeForAjax emits the following JavaScript on the page (alternatively, you could manually place the following two lines on the page):
<script language="javascript" src="ajax/common.ashx"></script> <script language="javascript" src="ajax/NAMESPACE.PAGECLASS,ASSEMBLYNAME.ashx"></script> |
NAMESPACE.PAGECLASS | The namespace and class of the current page (this will typically be the value of the Inherits attribute in the @Page directive) |
ASSEMBLYNAME | The name of the assembly the current page is part of (this will typically be the name of your project) |
<script type="text/javascript" src="ajax/common.ashx"></script>
<script type="text/javascript" src="ajax/AJAX_Test.WebForm1,AJAX_Test.ashx"></script>
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
// Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1)); 注销这段代码
}
结果运行正确.
得到的结论是,可能是该ajax的一个小Bug,产生的js代码不对.但是可以根据上述的规则人为添加js代码
相关文章推荐
- error C2470 错误记录与解决方法。“看起来像函数定义,但没有参数列表”
- C++ link2005 error 错误 解决方法汇总(一般重复定义,如果都是不就是 函数定义和实现没有分离)
- VS2010升级VS2013后,出现没有定义类型“PowerPacks.ShapeContainer”错误解决方法
- error C2470 错误记录与解决方法。“看起来像函数定义,但没有参数列表”
- error C2470 错误记录与解决方法。“看起来像函数定义,但没有参数列表”
- 一个关于“OLE DB 提供程序 'sqloledb' 指出该对象中没有任何列”错误的解决方法
- Dos下运行php.exe,出现没有找到 php_mbstring.dll 的错误解决方法
- 解决 Python.h:没有那个文件或目录 错误的方法
- 参照的汇编没有安装在系统上错误导致ocx注册失败的解决方法
- 定义span的最小高度没有效果的解决方法
- IE6下出现JavaScript未结束的字符串常量错误的解决方法
- Server2008R2:由于没有远程桌面授权服务器可以提供许可证,远程会话被中断..错误的解决方法
- EDK2开发中error C2220: 警告被视为错误 - 没有生成“object”文件的解决方法!
- 没有启动 ASP.NET State service错误的解决方法
- C# 001 --- 正确的删除一个控件的事件函数 --- 解决错误: “A”不包含“B”的定义,并且找不到可接受类型为“A”的第一个参数的扩展方法“B”(是否缺少 using 指令或程序集引用?)
- mysql-5.7.10-winx64免安装配置方法以及mysql服务无法启动 服务没有报告任何错误解决办法
- 微信开发: scope参数错误或没有scope权限解决方法
- Scope参数错误或没有Scope权限解决方法
- 微信公众平台开发教程(十)Scope参数错误或没有Scope权限解决方法
- SQL Server 2005 出现“此数据库没有有效所有者”错误的解决方法