Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to update a document displayed by the ASPxDocumentViewer within the ASPxPopupControl

$
0
0

This example illustrates how to update a web report's content on the fly by placing the ASPxDocumentViewer within the ASPxPopupControl and calling the ASPxClientDocumentViewer.Refresh method.

An additional hidden field is provided on the web page to pass parameter values to a report before its document is set forth and published using the ASPxDocumentViewer.

Question Comments

Added By: Nasser Alazemi at: 7/2/2015 10:09:32 PM    

This example not working

Added By: Dmitry Tok (DevExpress Support) at: 7/3/2015 2:42:21 AM    

Hello Nasser,

I have just tried to run this example online (here is a direct link) and download a sample project to my machine. In both cases, the sample project from this Code Example operates correctly. It would be great if you register a new ticket in our Support Center and describe what error you are facing with the sample project from this Code Example.

Thanks,
Dmitry

Added By: Alexandros Pappas 1 at: 8/5/2015 6:55:48 AM    

It is better to assign the report in the ASPxDocumentViewer's OnLoad event. And it is only necessary to do it upon a callback or a postback. Callbacks occur when the ASPxDocumentViewer is shown, and postbacks occur when a button on the ASPxDocumentViewer's toolbar is clicked. This has the advantage, that when the page contains other controls that produce callbacks like grids, the report is not created, saving processing time. I also found out, that there is no need to call this.DocumentViewer1.DataBind(), it does not seem to make any difference. Therefore, Default.aspx.cs can be written as follows:

using System;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
   protected void DocumentViewer1_Load(object sender, EventArgs e)
   {
       if (IsCallback || IsPostBack)
       {
           var hf = (HtmlInputHidden)this.Page.FindControl("ReportMsg");
           var report = new XtraReport1();
           report.Parameters["test"].Value = hf.Value.ToString();
           report.CreateDocument();
           this.DocumentViewer1.Report = report;
       }
   }
}

The OnLoad event must be added to DocumentViewer1:
                   <dxxr:ASPxDocumentViewer ID="DocumentViewer1" runat="server" ClientInstanceName="DocumentViewer"
                       ShowLoadingPanelImage="False" LoadingPanelText="" OnLoad="DocumentViewer1_Load">
                       <SettingsSplitter SidePaneVisible="False" />
                   </dxxr:ASPxDocumentViewer>


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>