logo
small logo
  • Ürünler
  • Satın al
  • Yardım
  • About
  • Kullanıcı paneli Yardım
    • en
    • de
    • JP
    • ZH
  • Anasayfa
  • /
  • Articles
  • /
  • How to update the FastReport.Core web report
  • How to use Online Designer in ASP .NET Core

    17 Ocak 2018

    One of the novelties by FastReport .NET 2018 was the adaptation of OnlineDesigner to the

    read more
  • FastReport .NET packages and .NET 5.0

    17 Aralık 2020

    UPD: Applies to the versions of FastReport .NET before 2022.2. License packages are now available

    read more
  • How to upload a report to OnlineDesigner and download it after editing in an ASP .NET Core application

    30 Haziran 2019

    While working with Fast Reports online report designer, we usually have to upload our report

    read more
  • Working with NuGet packages in FastReport

    22 Kasım 2021

    UPD: Applies to the versions of FastReport .NET before 2022.2. License packages are now available

    read more
  • Fast Reports Private NuGet-server

    15 Şubat 2022

    In the article on working with NuGet packages we considered all the specific features of

    read more

How to update the FastReport.Core web report

21 Eylül 2020

Sometimes you need to update the report, for example if you input a new variable value, or if you want to display another report in the same Web report object at all. This usually updates the entire view (we're talking about MVC applications) for the sub-set. But it would be much better if you updated only the Web report object.

  1. Update asp.net core report after variable change

https://forum.stimulsoft.com/viewtopic.php?f=13&t=57213

…

All this is great and working well. What we cannot figure out is how to refresh the report Variables with this new posted-back-up data and have the report redraw. Is this done within the Controller and, if so, how do we tell the viewer to refresh (thus getting the new data) or is this done within the View and, if so, what is the correct method to call on the Viewer object.

…

https://forum.stimulsoft.com/viewtopic.php?f=13&t=58104

How do I refresh a Web Report Viewer After Changing the Report.

…

 What is the object of the web report? Basically, it is an html container with a set of scripts that allow you to navigate through the pages of the report and call useful functions, such as printing and exporting. And the web report itself is a report exported to html. The easiest way to update a part of the page is to use iframe. We will only replace the frame source, and it will get a partial or full view of the report by url. Let's consider an example where the web application page displays a drop-down list and a frame. If you select a report name from the drop-down list, the web report object with the corresponding report is loaded.

To start with, we'll need a method in the controller that returns the view with the Web report object:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public IActionResult Update(string SelectedItem)
 {
 if (SelectedItem != null)
 {
 WebReport webReport = new WebReport();
 webReport.Report.Load($"App_Data/{SelectedItem}.frx");
 
 var dataSet = new DataSet();
 dataSet.ReadXml("App_Data/nwind.xml");
 webReport.Report.RegisterData(dataSet, "NorthWind");
 
 webReport.Width = "1000";
 webReport.Height = "1000";
 ViewBag.WebReport = webReport;
 } 
 return PartialView();
 } 

The method has an input parameter SelectedItem - the name of the selected report.

..

For this method you need to create a partial view with a single line of code that displays the web report object:

@await ViewBag.WebReport.Render()

Appearance of the Index start page will look like as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@{
 ViewData["Title"] = "Home Page";
}
 <div> 
 <select onchange="$('#partialViewDiv').attr('src', '/Home/Update?SelectedItem='+this.value)" id="report">
 <option disabled selected>default</option>
 <option>Lines</option>
 <option>Simple list</option>
 <option>Barcode</option> 
 </select>
 </div>
 <table>
 <tr>
 <td>
 <iframe id="partialViewDiv" width="1000" height="1000"></iframe> 
 </td>
 </tr>
 </table>

 First, we display a drop-down list with three available reports on the form. In the onclick list event handler, we assign a source url frame. The url itself contains the path to the web method with the parameter. The value of the parameter is taken from the selected item in the drop-down list. Below, the frame is displayed.

Let's run the application. Select a report from the drop-down list:

Selecting the web report

And will get it:

Updated web report

Thus, partial page refresh by using a frame is very easy to implement.

ürün hakkında satın al
avatar
Dmitriy Fedyashov
Technical Writer
Fast Reports Team: Dmitriy Fedyashov - Technical Writer at Fast Reports
.NET FastReport Core WebReport Upload

Yorum ekle
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Satın al
  • İndir
  • Dökümantasyon
  • Geribildirimler
  • Ürünlerimizi nasıl kaldırabilirsiniz
  • SSS
  • Başlangıç için Video
  • Forum
  • Articles
  • Haberlerimiz
  • Basında Biz
  • Partnerler
  • Extended licensing
  • Bize Ulaşın

© 1998-2023 by Fast Reports Inc.

  • Gizlilik Politikası