This is a migrated thread and some comments may be shown as answers.

Javascript Errors when displaying a Report Viewer...

2 Answers 199 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
mark baer
Top achievements
Rank 1
mark baer asked on 03 May 2011, 11:52 PM
I have a fairly simple page where a user selects report parameters, clicks a button, then a Report Viewer is displayed(visible=false on page load)...

I get this error after the user clicks the button:

Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ctl00_MainContent_ReportMainContent_ReportViewer1_ReportViewer'. If it is being updated dynamically then it must be inside another UpdatePanel.

I know it has to do with the Report Viewer being invisible at first, but I'm not sure how to use RadAjax and still hide the Report Viewer until I am ready to use it?  Below is the HTML and code behind for the button click.

Environment
Windows 7
Visual Studio 2010
ASP.NET 4.0
Latest Build for Telerik Controls(2011.1.413.40)
IE 8

thanks

mark

HTML

<P><%@ Page Title="" Language="C#" 
MasterPageFile="~/Modules/Reports/ReportMasterPage.master"<BR>    
AutoEventWireup="true" CodeBehind="AnalystBreakdownList.aspx.cs" 
Inherits="CreativeAffairsWebApp.Modules.Reports.AnalystBreakdownList" %></P>
<P><%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"<BR>    
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" 
%><BR><asp:Content ID="Content1" ContentPlaceHolderID="ReportHeadContent" 
runat="server"><BR></asp:Content><BR><asp:Content ID="Content2" 
ContentPlaceHolderID="ReportMainContent" 
runat="server"><BR>    <telerik:RadAjaxPanel 
ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" 
Width="100%"><BR>        <table 
style="width: 100%;" 
class="form"><BR>            
<tr><BR>                
<td><BR>                    
<table border="0" cellpadding="0" 
cellspacing="0"><BR>                        
<tr><BR>                            
<td><BR>                                
<asp:Label ID="Label1" runat="server" Text="As Of Date:" 
CssClass="formLabel"></asp:Label><BR>                                
<telerik:RadDatePicker ID="txtReportDate" 
runat="server"><BR>                                    
<Calendar Skin="WebBlue" UseColumnHeadersAsSelectors="False" runat="server" 
UseRowHeadersAsSelectors="False"<BR>                                        
ViewSelectorText="x"><BR>                                    
</Calendar><BR>                                    
<DateInput runat="server" DateFormat="M/d/yyyy" 
DisplayDateFormat="M/d/yyyy"><BR>                                    
</DateInput><BR>                                    
<DatePopupButton HoverImageUrl="" ImageUrl="" 
/><BR>                                
</telerik:RadDatePicker><BR>                            
</td><BR>                            
<td><BR>                                
&nbsp;&nbsp;&nbsp;&nbsp;<BR>                                
<telerik:RadButton ID="RadButton1" runat="server" Text="Run Report" 
OnClick="Button1_Click"><BR>                                
</telerik:RadButton><BR>                            
</td><BR>                        
</tr><BR>                    
</table><BR>                    
<br 
/><BR>                
</td><BR>            
</tr><BR>        
</table><BR>        <table 
width="100%"><BR>                
<tr><BR>                    
<td 
class="style1"><BR>                        
<asp:Panel ID="reportPanel" runat="server" 
Visible="false"><BR>                            
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%" 
Height="600px"<BR>                                
PageCountMode="Actual" ShowParameterPrompts="False" 
BackColor="White"><BR>                            
</rsweb:ReportViewer><BR>                        
</asp:Panel><BR>                        
<BR>                    
<BR>                    
</td><BR>                
</tr><BR>            
</table><BR>    
</telerik:RadAjaxPanel><BR>        
<BR>    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" 
runat="server" Skin="Default"><BR>    
</telerik:RadAjaxLoadingPanel><BR>    
<BR></asp:Content></P>

Code behind for button click:

 

<P>protected void Button1_Click(object sender, EventArgs 
e)<BR>        
{<BR>            
ReportViewer1.ProcessingMode = 
ProcessingMode.Remote;<BR>                        
<BR>            
ReportViewer1.ServerReport.ReportServerUrl = new 
Uri(ReportUtils.GetReportServerURL());<BR>            
ReportViewer1.ServerReport.ReportPath = 
ReportUtils.GetReportPath("AnalystBreakdownList");</P>
<P>            
ReportParameterCollection par = new 
ReportParameterCollection();<BR>            
ReportParameter username = new ReportParameter("UserName"
Utils.SessionValues.GetLoggedUserName());<BR>            
par.Add(username);</P>
<P>            
ReportParameter asOfDate = new ReportParameter("AsOfDate"
txtReportDate.SelectedDate.ToString());<BR>            
par.Add(asOfDate);</P>
<P>            
ReportViewer1.ServerReport.SetParameters(par);</P>
<P>            
reportPanel.Visible = 
true;<BR>            
//ReportViewer1.Visible = true;</P>
<P>            
ReportViewer1.ServerReport.Refresh();<BR>        
}</P>


2 Answers, 1 is accepted

Sort by
0
RRT
Top achievements
Rank 1
answered on 04 May 2011, 10:54 PM
I seem to have the same issue even without toggling Visible. I think mine just has to do with it being used with RadAjaxManager. If you have any thoughts, I'd love to hear it.
0
Maria Ilieva
Telerik team
answered on 09 May 2011, 10:29 AM
Hello Mark,

Wrapping the whole control which is visible false with RadAjaxPanel is a correct scenario and should works correctly. The error you are facing could be cause if the same controls is updated by RadAjaxManager and RadAjaxPanel at the same time. Please elaborate a bit more on your application so we could further research ont he issue. Also it will be very helpful if you could open regular support ticket and send us runnable version of your application. Thus we will be able to test it locally and advice you further.

Dominick,

Regarding the problem you are facing , note that it is not supported scenario to add invisible controls into RadAjaxManager settings. The controls should be always visible on the page. I would suggest you to add the mentioned controls into always visible contain (asp panel for example) and ad those containers into the RadAjaxManager settings.

Best wishes,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Ajax
Asked by
mark baer
Top achievements
Rank 1
Answers by
RRT
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or