[CLOSED] Ext.Net.X.Call failing with "unexpected token"

  1. #1

    [CLOSED] Ext.Net.X.Call failing with "unexpected token"

    Have some code that used to work, trying to figure out why it's now breaking. I stripped out everything except the html and body tags and can reproduce the issue.
    The "real" code builds an html page with a table and displays it in a window to print.

    The error is Status Code: 200Status Text: BADRESPONSE: Invalid or unexpected token. If I simply remove the "</body>" tag from the code ( Ext.Net.X.Call("PrintWindow.Show", "<html><body></body></html>") ) it works, although is is invalid HTML at that point so I replaced it with "test". Like I said, this used to work, not sure if it is a browser thing or what.

    <%@ Page Language="vb" %>
    
    <script runat="server">
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack AndAlso Not Ext.Net.X.IsAjaxRequest Then
      
            End If
    
        End Sub
    
        <DirectMethod()>
        Protected Sub btnRefresh_Click(sender As Object, e As DirectEventArgs)
    
            Ext.Net.X.Call("PrintWindow.Show", "<html><body></body></html>")
    
        End Sub
    
     </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Edit Grid</title>
    
    <script type="text/javascript">
        
            PrintWindow = {
                Show: function (htmlBody) {
                    var wnd = window.open("about:blank", "_blank", "height=800, width=1000,toolbar=no,scrollbars=yes,menubar=no");
                    wnd.document.write('test');
                    wnd.document.close();
                    wnd.focus();
                }
            }
    
    </script>
    
    
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
                <ext:Panel Title="Model Change Verification" runat="server" ID="pnlVerification">
                    <Items>
                       
                        <ext:Button runat="server" ID="btnRefresh" Text="ClickMe">
                            <DirectEvents>
                                <Click OnEvent="btnRefresh_Click"></Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
     
                </ext:Panel>
        </form>
    </body>
    </html>
    Last edited by fabricio.murta; May 16, 2017 at 6:49 PM.
  2. #2
    Hello @rmelancon!

    I believe this should be something specific to the project you are running. I couldn't reproduce this on my side.

    On MS-Edge, I get the pop-up opened, and the page shows 'test' on it. Using Chrome 58, the pop-up gets blocked. Of course, allowing the pop up I get the plain "test" page too.

    Did you try that on a fresh project? If so, are you using the latest v2 version (either from NuGet or from github)?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Looks like version is 2.5.0.90000

    For Nuget install do I use "-Version 2" or "-Version 2.5.3"?
    Last edited by rmelancon; May 04, 2017 at 1:08 PM. Reason: more info
  4. #4
    Hello @rmelancon!

    I believe you can just choose latest it shows. Should be 2.5.3 but it will require full version string in NuGet package manager console. If you are on VS2015 or VS2017, NuGet package manager dialog allows you to choose the version.

    From package manager console, when you type -Version <tab> (hit the 'tab key'), it will show you a drop-down with the available version numbers to complete.

    You should see something like this:
    Click image for larger version. 

Name:	61886-NuGetpkManCon.png 
Views:	131 
Size:	11.0 KB 
ID:	24934

    And the Ext.NET 2.5.3.1 seems to be the latest version available on NuGet for the 2 series.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Helo @rmelancon!

    It's been some days since we last replied you in this thread and no feedback from you still. Do you happen to still need help with this? If you don't reply in 7+ days, we may mark this thread as closed. Don't worry, you will be able to post here even after marked as closed if need be.
    Fabrício Murta
    Developer & Support Expert
  6. #6
    Didn't really fix it but a work around was to just leave out the ending body tag. Result is technically invalid html but for what I was using it for the browser rendered it fine.
  7. #7
    Hello @rmelancon!

    Well, glad you could find an approach that worked for you. Thanks for the feedback!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Feb 17, 2015, 11:42 AM
  2. Replies: 5
    Last Post: Feb 17, 2015, 6:03 AM
  3. [CLOSED] HtmlEditor.Call("append", "xxx") does not work
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 17, 2014, 11:36 PM
  4. Replies: 2
    Last Post: Aug 26, 2013, 10:52 AM
  5. [CLOSED] [MVC] Export Excel return "BADRESPONSE: Unexpected token <"
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 02, 2012, 3:05 PM

Posting Permissions