PDA

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



rmelancon
May 02, 2017, 8: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

<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>

fabricio.murta
May 04, 2017, 6: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)?

rmelancon
May 04, 2017, 2:03 PM
Looks like version is 2.5.0.90000

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

fabricio.murta
May 04, 2017, 8: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:
24934

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

fabricio.murta
May 13, 2017, 1: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.

rmelancon
May 16, 2017, 2: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.

fabricio.murta
May 16, 2017, 7:49 PM
Hello @rmelancon!

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