locked
AJAX & ReportViewer RRS feed

  • Question

  • Hi,

    My problem is:
    I want use AJAX components (AJAXControlToolkit) and it works fine. But when I put ReportViewer on my page strange things happens. ReportViewer or AjaxControls don't work properly, or even don't work at all.
    I don't know what to do... Help me plz...

    Friday, March 9, 2007 2:11 PM

Answers

  • Due to the way the report viewer uses script, it is currently not compatible with an UpdatePanel.  We are aware of this problem and looking into the necessary changes to get the ReportViewer working in an UpdatePanel.  But at present, there is no work around.  While it may appear you can get simple reports working in this scenario, some of the more subtle report viewer behavior will still be broken, such as its code that keeps the report session alive when the browser window is left open.
    Friday, March 16, 2007 2:29 AM

All replies

  • Hi,

    As far as I know, ReportViewer needs a full postback to work so it won`t work inside an Ajax UpdatePanel if you don't set a full postback trigger.

    A few weeks ago, I tried to insert a reportViewer inside an updatePanel, but It did not work at all, ( I had a child-parent report). After searching in this forum and over the internet, I got the answer that It doesn´t work.  Maybe one of the MSFT could clarify a bit more the issue

    Hope this help

    Turg

     

     

    Saturday, March 10, 2007 12:25 AM
  • Last time I tried it ,about 4 months, i could get it to work as long as your report didn't require the user to interact with it at all. If I'm not mistaken I had to set AsyncRendering or something along those lines to false.  A far better solution, especially if you don't know your users resolution settings or if your rendering large reports is to use the following lines of code and place your reportviewer in a new window.

    string query = "window.open('Report.aspx?passmyparamshere','new_Win');";

    ScriptManager.RegisterStartupScript(Page,Page.GetType(),"wOpen", query, true);

     

    Sunday, March 11, 2007 3:52 AM
  • Due to the way the report viewer uses script, it is currently not compatible with an UpdatePanel.  We are aware of this problem and looking into the necessary changes to get the ReportViewer working in an UpdatePanel.  But at present, there is no work around.  While it may appear you can get simple reports working in this scenario, some of the more subtle report viewer behavior will still be broken, such as its code that keeps the report session alive when the browser window is left open.
    Friday, March 16, 2007 2:29 AM
  • I was planning to implement ajax control with report viewer, but not any more. My main problem is cascading parameter doesn't work with rs webpart in sharepoint 2007. same problem with regular reporting services subscription and cascading parameter.

    SharePoint Blog

    Sunday, March 18, 2007 3:32 PM
  • Does "not compatible" include scenarios where a reportViewer shares a page with an update panel, but does not reside in it?  I have the following scenario:

    <update panel>

       <usercontrols for parameter input />

    </ update panel>

    <asp button triggering full postback and loading report />

    <report viewer />

     

    On the second and any subsequent postbacks a javascript alert box pops up with a Specified Argument out of range... message.  Clicking the button after triggering this message results in the full error below.  I've tested the full setup without the update panel and the update panel without the report viewer, and both parts work correctly. Only when the two co-exist on the page does the error occur.

     

    If I should be able to make this set-up work and am just missing some piece, please let me know -
    Sarah

     

    [ArgumentOutOfRangeException: Specified argument was out of the range of valid values.]
       Microsoft.Reporting.WebForms.ReportViewer.set_CurrentPage(Int32 value) +101
       Microsoft.Reporting.WebForms.ReportViewer.ClientSidePageNumberChanged(Object sender, EventArgs e) +78
       System.Web.UI.WebControls.HiddenField.OnValueChanged(EventArgs e) +105
       System.Web.UI.WebControls.HiddenField.RaisePostDataChangedEvent() +28
       System.Web.UI.WebControls.HiddenField.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +7
       System.Web.UI.Page.RaiseChangedEvents() +137
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4778

     

    Thursday, November 15, 2007 5:50 PM
  • Lambrite, did you ever find a solution for this?

     

    I have a page layout simliar to yours.  The problem in my application is slightly different than yours.  In my project, I have two dropdown lists, a button and a ReportViewer control.  As follows:

     

    <asp dropdownlist/>

     

    <asp updatepanel>

    <asp dropdownlist/>

    </asp updatepanel>

     

    <asp button triggering full postback and loading report />

    <report viewer />

     

    Whatever is selected in the first dropdown list determines what gets displayed in the second dropdown list.  If I select something from the first dropdown list, select another value from the second list, then hit submit, I get the "full error" you described.  BUT, if I just select from the second dropdown list, and then hit submit, it works fine.  And then, if I select from both dropdown lists -- first dropdown list, and then the second --  and then click submit, it works fine.  As it should when I come to the page for the first time, but it doesn't.

     

    This is a big bug, IMHO.

     

     

     

    Craig

    Wednesday, November 21, 2007 7:42 PM
  •  

    I found a solution for this.

     

    In the aspx page, set the ReportViewer visibility to false.

     

    <rsweb ReportViewer Visible="false"/>

     

    In the button_click event, set the ReportViewer visibility to true.

     

    ReportViewer1.Visible = True

     

    Seems to work fine for me, so far.

    Friday, November 23, 2007 3:11 PM
  • This does work, although in my case it means that the user cannot see the parameters for the report at the same time as he sees the report, which is acceptable though undesireable.  Hopefully, they'll get a real solution worked out soon.

    Tuesday, November 27, 2007 6:10 PM
  • You can write a user control that calls the Report Web Service and generates an interface for the report. I thought this would be a huge project but it wasn't and I even use AJAX control toolkit items.

     

    • Proposed as answer by Surendran08 Tuesday, March 23, 2010 6:56 AM
    Tuesday, November 27, 2007 7:20 PM
  • Can you elaborate?

     

    I'm running into a plethora of problems trying to simply refresh a report with parameters. 

    Monday, December 3, 2007 6:37 PM
  •  

    Go to next post

    Monday, December 10, 2007 7:21 AM
  • I Create a control that solved problem of Server Reports But I dont know what can I do for Local Reports because I don't know how can I find path of local report and I can't render controls on IFrame the control code is here:

     

    using System;

    using System.ComponentModel;

    using System.Collections;

    using System.Collections.Specialized;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Drawing.Design;

    using System.Drawing;

    using Microsoft.Reporting.WebForms;

    using System.Collections.Generic;

    namespace MaskanProject.Common.Controls

    {

    public class MYReportViewer : ReportViewer

    {

    private string EmumProperties()

    {

    string paramsString = String.Empty;

    ReportParameterInfoCollection collect = null;

    if (ProcessingMode == ProcessingMode.Local)

    {

    //???

    }

    else

    {

    collect = ServerReport.GetParameters();

    }

    if (collect != null)

    {

    foreach (ReportParameterInfo param in collect)

    {

    paramsString += "&"

    + param.Name

    + "=" + param.Values.ToString();

    }

    }

    return paramsString;

    }

    public string BuildUrlString()

    {

    string url = string.Empty;

    if (ProcessingMode == ProcessingMode.Local)

    {

    //???

    }

    else

    {

    url = this.ServerReport.ReportServerUrl + "?" + this.ServerReport.ReportPath +

    "&rs:Command=Render" + this.EmumProperties();

    }

    return url;

    }

    #region Render

    /// <summary>

    /// Render the report in an IFrame

    /// </summary>

    /// <param name="output"></param>

    protected override void Render(HtmlTextWriter output)

    {

    // Create IFrame if the user enters ServerUrl and ReportPath

    output.WriteBeginTag("iframe");

    output.WriteAttribute("src", this.BuildUrlString());

    output.WriteAttribute("width", this.Width.ToString());

    output.WriteAttribute("height", this.Height.ToString());

    output.WriteAttribute("style", "border: 1 solid #C0C0C0");

    output.WriteAttribute("border", "0");

    output.WriteAttribute("frameborder", "0");

    output.Write(HtmlTextWriter.TagRightChar);

    output.WriteEndTag("iframe");

    output.WriteLine();

    }

    #endregion

    }

    }

     

    this control work verey well but just for server reports.

    Tuesday, December 11, 2007 11:47 AM
  •  

    Hi frds,

     this one is very simple, first i also got lot of trouble from it but finally i got soltuion from it,

     what to do is only ,in code behind you do reportviewer object (like reportviewer1.visible=true) property is true,

    i dont know the reasion behind to work this but it works and what we need it only.

     

    ~Peeyush

    Monday, January 21, 2008 5:35 PM
  • Thanks, but I already suggested this (see my post above).

    Thursday, January 24, 2008 9:18 PM
  • It is very interesting this control but i'm not familiar with controls. I would like to have a demo how to get this all work. Please if you port it will be great for me because the report viewer is getting me furious. Very helpful threed but please post a demo project with that control. Thank you.
    Saturday, April 25, 2009 1:41 PM
  • For me the problem is solved after creating a user control.

    Thanks Akula.

    Tuesday, March 23, 2010 6:55 AM
  • Thanks Craig, It worked for me. I my case the Problem is only with fire fox. In IE it was fine.
    Friday, March 26, 2010 9:56 AM
  • hi,

    i am using reportViewer inside the updatepanel.

    using this code m able to view the report

            Reportviewer.AsyncRendering = false;
            if (!Reportviewer.Enabled) Reportviewer.CurrentPage = 1;

    but i when i try to use the report viewer controls like export , refresh etc...

    m getting a javascript error 'this.Controller' is null or not an object.

    Does any1 have a solution for this??

    kindly help me out

    Tuesday, April 6, 2010 9:12 AM
  • Hi there. Note that the ReportViewer control in the upcoming VS2010 release will be an AJAX control, fully compatible with UpdatePanels.
    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, April 6, 2010 2:06 PM
  • Did anyone have any luck in trying to get the reportviewer in VS2010 work in an updatepanel?

    I tried but could not get it to work.

    Thursday, April 22, 2010 2:28 PM
  • Can you elaborate on "could not get it to work"?
    Cephas Lin This posting is provided "AS IS" with no warranties.
    Monday, April 26, 2010 2:08 PM
  • In VS2008 like others have mentioned in the thread above ReportViewer was not compatible in an updatepanel.
    In many of the forums I have seen assurances that in VS2010 this would be address.
    So my question was has anyone tried to make it ReportViewer work in an updatepanel in VS2010? I tried but could not get it to work.

     

    Tuesday, April 27, 2010 2:21 PM
  • Still not sure what "could not get it to work" means. Errors? UI behavior?

    I just tested the following steps and they do work. Let me know if these are the same steps for you.

    1) Drag a ScriptManager to the form

    2) Drag an UpdatePanel to the form

    3) Drag a ReportViewer to the form inside the UpdatePanel

    4) Configure the ReportViewer for the appropriate report

    5) Run the app


    Cephas Lin This posting is provided "AS IS" with no warranties.
    • Proposed as answer by RMehta Friday, June 25, 2010 4:57 PM
    Tuesday, April 27, 2010 2:46 PM
  • Hi Craig,

    I have the the same problem with ReportViewer control and RadAjaxManager. The solution what you said is helped me in solving my problem.

    Thanks!

    Thursday, May 6, 2010 7:23 AM
  • I got it to work too Cephalin thanks. I think I know why my initial attempt failed.
    The project that I was working with was built in VS2008 and I upgraded it to VS2010. I am still having issues with that one.
    But when I create a new project it VS2010 I have no issues.

     

    Friday, June 25, 2010 4:57 PM
  • For your upgraded VS2008 project, you'll need to update your references from the 9.0 viewer to the 10.0 viewer. This needs to be done in the project's References in solution explorer, in the Web.config, and at the top of your ASPX file.
    Cephas Lin This posting is provided "AS IS" with no warranties.
    Friday, June 25, 2010 9:37 PM
  • Craig, et al - 

    I was able to get the RadAjaxManager to help with a bunch of controls (stop page postback after each control update) and then click a button and show and run the report using the visibility = false and true switch.

    However, when the user goes back and tries to change a value in one of the controls, the code behind is not working and I am getting the 'specified argument out of range' error again.

    Does anybody know of a way around this?

    I tried to use some events to make the reportviewer.visibility false again, but it isn't working.

    So frustrating.

    How can we use ajaxified controls and the reportviewer on the same page?!

    Thanks for any help.

    -M


     

    Thursday, September 30, 2010 7:08 AM
  • Hi All,

    Even I am struck with the same issue with ajaxified control and a reportviewer on a page. (report viewer 10 )

    when some dropdown value is changed in the control, the reportviewer used to load back with the updated parameter, thou I stopped that by using some variables..

    but the still ther reportviewer gets disabled and enabled when the page post back happens and the scroll bar is set top of the page

    Please let me know if any of you have any solution for this issue..

    Thanks in Advance

    -Lakshmi

     

     

     

     

     

     

    Monday, February 7, 2011 10:53 AM
  • Thanks Cephas. It works.

    Another question is when I update ReportViewer with UpdatePanel, in client site(IE6) it occurs javascript error as "this._docMapSplitter is null  or not object".

    But in IE8, Firefox, or Chrome it's fine.

    Does there some way to fix this issue?

    Really thanks~

    Friday, November 2, 2012 3:19 AM
  • ReportViewer not work in update Panel
    Wednesday, May 7, 2014 9:41 AM