要摆脱这些不必要的 .axd 文件,请使用 Microsoft 的 Ajax.dll 并为它编写您自己的代码。使用 Ajax 的示例如下。
假设我在单击按钮时使用了多次删除功能,并且由于页面加载而我不想使用更新面板试试这个。
using Ajax;
在页面加载事件 page_Load 上注册您的控件
Ajax.Utility.RegisterTypeForAjax(typeof(Admin_UserControls_Delete));
方法
[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);
}