开发者

Remove all .axd files from a webpage in ASP.NET 4.0

开发者 https://www.devze.com 2023-04-09 04:14 出处:网络
I have added Ajax ToolKit in my website, but due to heavy load on the page we want to remove the Ajax Tool Kit.

I have added Ajax ToolKit in my website, but due to heavy load on the page we want to remove the Ajax Tool Kit.

To remove I deleted the file from the bin folder, Removed the control tab from Tools.

Now when I run the website, I see certain Webresource.axd? and Scriptresource.axd? script files in the project.

One file is too heavy around 55 KBs which affects the load time of the page.

Note: I am using Script Manager and update panel on the开发者_JAVA技巧 page, but all reference to Ajax ToolKit is removed. my project is a website in .NET 2010 using 4.0 framework.


To get rid of such unnecessary .axd files use Ajax.dll from Microsoft and wirte your own code for it. example for using Ajax is as follows.

Suppose i am using Multiple Delete function on button click and i dont want to use Update panel due to page load try this.

using Ajax;

Register your control on Page Load event page_Load

Ajax.Utility.RegisterTypeForAjax(typeof(Admin_UserControls_Delete));

method

[Ajax.AjaxMethod()]
 public int deleteRecords(int ID,string spName)
 {
   // delete code block
 }


> In your **markup source on client click of button** call the javascript.

function callbackmethod(response) {
        if (response.value > 0) {
            alert("Record deleted Successfully");
            window.location.reload();
        }
        else {
            alert("Can Not Delete Record,It is being Used");
        }
}

function DeleteMultipleRecords() {

    //delete block to get the param values 
  var str = Admin_UserControls_Delete.deleteRecords(param1,param2,callbackmethod);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消