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.