• AJax错误"WebForm1"没有定义的javascript错误的解决方法


           笔者在研究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):

    <script language="javascript" src="ajax/common.ashx"></script>

    <script language="javascript"
               src="ajax/NAMESPACE.PAGECLASS,ASSEMBLYNAME.ashx"></script>

     Where the bolded parts have the following meaning:

    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)


    发现该产生的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代码

  • 相关阅读:
    regsvr32 错误解决方案
    cefsharp解决闪烁
    WPF使用cefsharp 下载地址
    Winform下CefSharp的引用、配置、实例与报错排除(源码)
    cefSharp在XP下使得程序崩溃记录
    mvc3在window 7 iis7下以及 xp iis 5.1下的部署 ,asp.net MVC3无法打开项目文件E:/我们的项目/Project/HeatingMIS.Web/HeatingMIS.Web.csproj”。此安装不支持该项目类型。
    顺序程序设计
    你对linux了解多少,Linux 系统结构详解!
    算术运算符和算术表达式(优先级,结合性等)
    离散化和面元划分(可以理解为划分段)
  • 原文地址:https://www.cnblogs.com/meetweb/p/285838.html
Copyright © 2020-2023  润新知