Ajax error "webform1" does not define the Javascript error Solution

Source: Internet
Author: User

The pen is studying quickguide.txtArticleAt the same time, according to the step-by-step method, when the result is run, it is found that such an error always occurs, "webform1" does not have a javascript error defined, changed to the project as the root directory, the error is still
Using Google to search on the Internet, we found that many of our friends had the same error.
Therefore, it is generated that the DLL is not downloaded correctly. However, according to the document, the system queries

Private void page_load (Object sender, system. eventargs E)
{
// Place the user hereCodeTo initialize the page
Ajax. Utility. registertypeforajax (typeof (webform1 ));
}

After this is set, code will be generated in the Web
<SCRIPT type = "text/JavaScript" src = "/ajax/common. ashx"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "/ajax/ajax_test.webform1, ajax_test.ashx"> </SCRIPT>

This proves that the DLL can function, that is, the DLL can run normally. How can this problem be solved ??

According

The callRegistertypeforajaxEmits the following JavaScript on the page (Alternatively, you cocould manually place the following two lines on the page ):

>

>

 Where the bolded parts have the following meaning:

Namespace. pageclass

The namespace and class of the current page

(This will typically be the value ofInheritsAttribute in@ PageDirective)

Assemblyname

The name of the Assembly the current page is part

(This will typically be the name of your project)

The generated code must beAjax/is the root, so according to the above description, manually add a piece of code in the aspx File
<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)
{
// Place user code here to initialize the page
// Ajax. Utility. registertypeforajax (typeof (webform1); cancel this code
}
The result is running correctly.
The conclusion is that it may be a small bug of Ajax, And the generated JS Code is incorrect. However, you can add js code manually according to the above rules.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.