admin管理员组文章数量:1326339
I was just skinning my site with new theme, is it possible to change the loading image (which has green color) of the ReportViewer control?
I tried some solutions suggested but its not working, can anyone guide me on this?
I was just skinning my site with new theme, is it possible to change the loading image (which has green color) of the ReportViewer control?
I tried some solutions suggested but its not working, can anyone guide me on this?
Share Improve this question asked May 28, 2012 at 12:33 MaxRecursionMaxRecursion 4,91112 gold badges44 silver badges77 bronze badges 1- These are embeded inside the reportviewer dll i believe. Sadly, i don't know any easy method to change it. – nunespascal Commented May 28, 2012 at 12:59
2 Answers
Reset to default 6You can always modify it with CSS.
If you investigate the HTML which is rendered from the ReportViewer control, there should be a <div>
called [ID_of_control]_AsyncWait_Wait
On mine, I have the css;
<style>
/* this will remove the spinner */
div#ReportViewer1_AsyncWait_Wait img{ display: none; }
/* this allows you to modify the td that contains the spinner */
div#ReportViewer1_AsyncWait_Wait table tbody tr td:first-child{ background: red; width: 100px; height: 100px; }
</style>
All you need to do is set the background-image
on div#ReportViewer1_AsyncWait_Wait table tbody tr td:first-child
in order to have your own custom image.
The following solution achieves a replacement loading image using jQuery and CSS. Environment is Visual Studio 2013, ReportViewer 10.0, .NET 4.0.
The technique uses window.setInterval to replace the loading image and keep it replaced. In some instances, such as selecting cascading parameters, the ReportViewer replaces much of its DOM contents, including the loading image. So, simple solutions using a CSS background-image or a one-time replacement of the loading image using jQuery do not work.
Given a ReportViewer control added to a .ASCX user control:
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%-- replace stock SSRS wait control ("green spinner") with our own; execute every 200 milliseconds --%>
<script type="text/javascript">
$(document).ready(function () {
OurApp.timeoutID = window.setInterval(OurApp.reportViewerWaitControlSubstitute, 200);
});
</script>
<rsweb:ReportViewer ID="rvc0" runat="server" ... CssClass="ReportViewerControl" ... >
</rsweb:ReportViewer>
JavaScript:
var OurApp= OurApp|| {};
OurApp.reportViewerWaitControlSubstitute = function () {
var control = $('.ReportViewerControl div[id$="_AsyncWait_Wait"] img');
var source = control.attr("src");
var path = "/media/images/atom.gif";
var style = "height:48px;width:48px;border-radius:10px;margin-right:10px";
//don't replace if already our image, or it will not animate
if (source && (source != path)) {
control.attr("src", path);
control.attr("style", style);
}
}
CSS (for rounded corners and a more even arrangement of image and text):
.ReportViewerControl div[id$='_AsyncWait_Wait'] {
border-radius:10px;
padding:15px 15px 0 !important}
The result:
The particular .gif is of an animated atom, and looks very cool when ReportViewer elements are loading!
本文标签: javascriptReportviewer control loading indicator in ASPNETStack Overflow
版权声明:本文标题:javascript - Reportviewer control loading indicator in ASP.NET - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742200127a2431750.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论