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

Refresh only report viewer

4 Answers 498 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 10 Aug 2011, 03:51 PM
Hi,

I have a strange question for you : it is possible to add parameters to the report viewer using JS ? In my case, I have a splitter with 3 panes (take a look to the attached png) and I want my report (in the right lower pane) to show the value of the textbox in the upper pane. Moreover, I don't want my left pane (the one with the tree view) and my upper pane to be refresh each time I reload the report. In other words, when I click on the button "preview", the report should be updated with the good values, but not the upper pane neither the left pane. So, I think I should use javaScript, but I'm not sure if it possible to realise my scenario with JS.

Does anyone have a solution for me ?
Thank you

David

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 10 Aug 2011, 04:44 PM
Hi David,

You can use the following code in the Preview button event handler:

protected void Button1_Click(object sender, EventArgs e)
    {
         Telerik.Reporting.Report report = (Telerik.Reporting.Report)this.ReportViewer1.Report;
         report.ReportParameters["MyParam1"].Value = TextBox1.Text;
         report.ReportParameters["MyParam2"].Value = TextBox2.Text;
         ReportViewer1.RefreshReport();
    }


All the best,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
David
Top achievements
Rank 1
answered on 10 Aug 2011, 07:06 PM
Hi Steve,

Thank you for your fast answer, but it doesn't really help me. Maybe I miss something really simple here, but you give me some server-side code and, for what I know, server-side call automatically refresh the page. Nonetheless, I tried your code, but in a different way. First, when my button is click, I call a js function who call the onAjaxtRequest event of the my AjaxManager (I put your code in the event hander). Here is my ajaxManager :

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="buttonPreview_Click">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="ReportViewer1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

So, this way, only the reportViewer is refresh. But I now have a new problem : by doing so, the reportViewer is now stuck to a fixed height (something close to 100px). I'm pretty sure that the problem is because the height of my reportViewer is set to 100%, but I don't know how to correct it (I want my report to take all the all the possible height). Do you have any idea how to correct this problem. Or is it possible to use the server-side event of the radButton without doing a post-back ?

Thank you
David
0
David
Top achievements
Rank 1
answered on 10 Aug 2011, 08:14 PM
Hi again,

Sorry for this double post, but I realize that I didn't well explain my problem. In fact, my treeview in my left pane is bind to a dataSet on the page load. The first time the page load, the treeView is "not expand" and the user have to expand it and select the wanted value. But if the report is refresh, then the page is reload and the treeView is "not expand" again. I don't want that. I want my treeView to stay expand and that the selected value stay selected, even if the report is reload. This is why I said that I didn't want to refresh all the page, but just the report. Does anyone have a solution ?

Thank you,
David 
0
Accepted
Plamen
Telerik team
answered on 15 Aug 2011, 03:51 PM
Hi David,

There is no way to specify a report parameter value through javascript and that is why I've given you a code how to accomplish this in general. Ajaxifying certain controls does not avoid the postback to the page, you can set break points in Page_Load and see that it is still fired.
Generally you can make your current solution more straight-forward by setting the Preview button as initiator of the ajax request and the ReportViewer as updated control.

As for the treeview, you may have a look at this help topic that explains how to scroll a node into view after Ajax request.

Kind regards,
Plamen Zdravkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Steve
Telerik team
David
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or