View Full Version : [CLOSED] Ext.Net.X.Call failing with "unexpected token"

May 02, 2017, 7:49 PM
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

Protected Sub btnRefresh_Click(sender As Object, e As DirectEventArgs)

Ext.Net.X.Call("PrintWindow.Show", "<html><body></body></html>")

End Sub


<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");


<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />

<ext:Panel Title="Model Change Verification" runat="server" ID="pnlVerification">

<ext:Button runat="server" ID="btnRefresh" Text="ClickMe">
<Click OnEvent="btnRefresh_Click"></Click>


May 04, 2017, 5:52 AM
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)?

May 04, 2017, 1:03 PM
Looks like version is

For Nuget install do I use "-Version 2" or "-Version 2.5.3"?

May 04, 2017, 7:06 PM
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:

And the Ext.NET (https://www.nuget.org/packages/Ext.NET/ seems to be the latest version available on NuGet for the 2 series.

May 13, 2017, 12:49 AM
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.

May 16, 2017, 1:49 PM
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.

May 16, 2017, 6:49 PM
Hello @rmelancon!

Well, glad you could find an approach that worked for you. Thanks for the feedback!