[CLOSED] The function "addScript" causing the error "Syntax Error"

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #21
    Hello Daniil,

    - I have completed the tests (without an iframe for now) and I have good news.
    - Everything works as expected in all browsers tested(IE11,FF,Chrome).

    1. In debug mode inside VS 2012 the debugger stops code execution only once during the initial loading of the page. Selecting to continue allows the page to load as expected. Subsequent page reloads trigger the same behaviour (break once, select to continue, all goes well). So far, it seems that the theory that the debugger prematurely intervenes and complains about the syntax error before the anchor tag gets a chance to be replaced holds water.
    2. I deployed to production server and no error is raised in the browsers and the page behaves as designed including layouts etc.
    3. I made a little tweak that helped make the initial loading of the page smoother: I do not assign a report path to the report viewer inside its markup tag. I populate the ReportPath property of the Report Viewer in the page's Page_Load event. This causes the report to be loaded a bit later in the page lifecycle when all the scripts had a chance to load properly.

    - I am attaching a sample page for future reference.
    - The sample also demonstrates how to reload a report via a Direct Method passing user defined parameters. (The actual code that passes parameters to the report is outside the scope of this sample).

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server"> 
    <!--Chrome/FF fix for Report Viewer -->
        overflow: visible !important;
     <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
          // check both Ext.Net and ASP.Net for initial loading status in ordr to be on the safe side
          if (!X.IsAjaxRequest && !Page.IsPostBack)
            //Prepare Report
              this.RptViewer1.ServerReport.ReportPath ="\Reports\test";
            //load report
        public void Reload_Report(string some_parameter)
          // pass parameters to report through ReportViewer.ServerReport.SetParameters method
          //reload happens in callback handler of Direct Method (client-side)
     <script type="text/javascript">
    function reload_rpt() {
      //sample user parameter to pass to report
      var rpt_id = App.txt_rpt_id.value;
      App.direct.Reload_Report(rpt_id,  {
          success: function () {
            //refresh report using ReportViewers client JS library. This is ReportViewer's JS library, not Ext JS.
            var viewer = $find("RptViewer1");
            if (!viewer.get_isLoading())
           //end of Report Viewer JS library code
          eventMask: { showMask: true, msg: "Please wait..." },
          failure: function (errorMsg) { Ext.Msg.alert("Problem", errorMsg); }
        <form id="form1" runat="server">
        <asp:ScriptManager ID="sm1" runat="server" EnableScriptGlobalization="false" ScriptMode="Debug" />
        <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Default" DisableViewState="false" ScriptMode="Debug"  />
          <ext:Viewport ID="vport_main" runat="server" Layout="FitLayout">
              <ext:Panel ID="pnl_main" runat="server" Frame="true" Layout="VBoxLayout" TitleAlign="Center" Icon="Report">
                  <ext:VBoxLayoutConfig Align="Stretch" />
                  <ext:FormPanel ID="pnl_param" runat="server" AutoScroll="true" Hidden="false" Title="params" Collapsible="true" >
                      <ext:TextField ID="txt_rpt_id" runat="server" AllowBlank="true" FieldLabel="rpt_id" LabelWidth="100" MaxLength="5" EnforceMaxLength="true" MaskRe="[0-9]" MarginSpec="2" Text="1" />                  
                      <ext:Toolbar ID="tlb_param" runat="server">
                          <ext:ToolbarFill runat="server" />                       
                            <ext:Button ID="btn_rpt_reload" runat="server" Text="Execute" >
                                  <Click Fn="reload_rpt" />
                  <ext:Panel ID="pnl_rpt" runat="server" AutoScroll="true" Flex="1">
                      <asp:UpdatePanel runat="server">
    				              <rsweb:ReportViewer runat="server" ID="RptViewer1" Font-Names="Verdana" Width="100%" Height="100%" ShowPrintButton="false" ShowFindControls="false" Font-Size="10pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="12pt" >
    					              <ServerReport ReportPath="" ReportServerUrl="http://*.*.*.*/ReportServer" />   
    I hope that this helps clarify things.

    You can close the thread if you like. I would also like to test the iframe scenario but I am currently under a deadline so that will have to wait.


    P.S. I can send you the URL of a test production server plus relevant source code files in order to see the user experience client-side and possibly debug the Server Response and also check if any errors are raised in the browsers' JS execution. If you think that such a thing would be helpful please send an e-mail address to my e-mail so i can forward you the relevant information.
    Last edited by AnFil; Sep 25, 2015 at 9:32 PM.

Similar Threads

  1. Replies: 6
    Last Post: May 31, 2013, 3:04 AM
  2. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  3. Replies: 4
    Last Post: Oct 11, 2011, 2:42 AM
  4. Replies: 4
    Last Post: Aug 24, 2011, 11:29 AM
  5. Replies: 8
    Last Post: May 30, 2011, 5:55 PM

Tags for this Thread

Posting Permissions