我们在使用VS2010中的ReportViewer(rdlc)控件的Azure Web应用程序中显示报告,该报告运行良好。最近,我的客户要求我为ReportViewer捕获Print事件并在服务器上记录一个条目。我已经用打印按钮挂钩了。当我在本地环境中运行Web应用程序时,这非常有效。但是,在Azure上,Ajax方法永远不会从客户端调用。请建议做什么? Azure环境中的Ajax是否存在限制?Windows Azure中的AjaxMethods不起作用
我注册页面上的Page_Load中的代码背后
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(Pages.Report));
ImageButton btnPrint = new ImageButton();
btnPrint = ((ImageButton)(this.FindControl("ctl00$" + ReportViewer1.ClientID.Replace("_","$") + "$ctl06$ctl06$ctl00$ctl00$ctl00")));
btnPrint.Attributes["onclick"] += "attachEventForPrint();";
}
[AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public static void LogEvent(int pLoggingEvent)
{
// Addded logic to log event
}
而且在ASPX文件下面的函数在JS加入
function attachEventForPrint() {
if (typeof (Report) != "undefined") {
Report.LogEvent(4);
}
}
我从来没有使用过Microsoft Ajax,但我使用jQuery和Ajax在我们的MVC应用程序中没有问题。 – vtortola 2011-05-03 09:31:05