CompatibleReportViewer.cs 934 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.IO;
  7. namespace EMIS.Web.Controls
  8. {
  9. public class CompatibleReportViewer : Microsoft.Reporting.WebForms.ReportViewer
  10. {
  11. protected override void Render(HtmlTextWriter writer)
  12. {
  13. if (!HttpContext.Current.Request.Browser.Browser.Contains("InternetExplorer"))
  14. {
  15. using (StringWriter sw = new StringWriter())
  16. {
  17. HtmlTextWriter tmpWriter = new HtmlTextWriter(sw);
  18. base.Render(tmpWriter);
  19. string val = sw.ToString();
  20. val = val.Replace(@"!= 'javascript:\'\''", @"!= 'javascript:\'\'' && false");
  21. writer.Write(val);
  22. }
  23. }
  24. else
  25. {
  26. base.Render(writer);
  27. }
  28. }
  29. }
  30. }