ASP.NET Multiview Error - Microsoft JScript compilation error: Syntax error

Jun 30, 2009 at 4:47 PM

Hi,

I have come across an interesting situation where the Amazon version of the component comes up with the parse error when

executed from a view invoked via Multiview.  If no view is invoked, the error does not occur.  Additionally, the standard non-amazon

component works fine.  The error is the following;

---------------------------------------------------------------------------

Microsoft JScript compilation error: Syntax error
_processRequest: function(json){
        var files = eval("["+json+"]")[0];     <--- Error line
        this._arr = [];
        for(var j = 0; j < files.length; j++

-----------------------------------------------------------------------------

In order to get the error, just use this very simple example...Click on a button to switch

view (2) , then try uploading with standard component (no error), and amazon component (error).

Interstingly, if I run amazon component from a non-switched view, it works fine in the same project

Considering that the standard file uploader and amazon file upload components should be very similar

apart from the delivery mechanism, I guess its a bug?

 

-----------------------------

.asp

--------------------------

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<font size="3">

<%

</font>

 

@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"

%><font size="3">

<%

</font>

 

@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader"

%><font size="3">

<%

</font>

 

@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.DirectAmazonUploader"

%>

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

<!

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><font size="3" color="#0000ff"><font size="3" color="#0000ff">

<

</font></font><font size="3" color="#0000ff">

 

</font>

 

html xmlns

="http://www.w3.org/1999/xhtml"><font size="3" color="#0000ff"><font size="3" color="#0000ff">

<

</font></font><font size="3" color="#0000ff">

 

</font>

 

head runat

="server">

<font size="3">

 

</font>

 

<title></title

><font size="3" color="#0000ff"><font size="3" color="#0000ff">

</

</font></font><font size="3" color="#0000ff">

 

</font>

 

head

><font size="3" color="#0000ff"><font size="3" color="#0000ff">

<

</font></font><font size="3" color="#0000ff">

 

</font>

 

body

>

<font size="3">

 

</font>

 

<form id="form1" runat

="server">

 

<font size="3">

 

</font>

 

<asp:HiddenField ID="HiddenView" runat="server"

/>

 

<font size="3">

 

</font>

 

<div

>

 

<font size="3">

 

</font>

 

<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"

>

 

<font size="3">

 

</font>

 

<asp:View ID="View1" runat

="server">

 

<font size="3">

 

</font>

 

<asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Go To Multiview 2"

/>

 

<font size="3">

 

</font>

 

</div

>

<font size="3">

 

</font>

 

</asp:View

>

 

<font size="3">

 

</font>

 

<asp:View ID="View2" runat

="server">

 

<font size="3">

 

</font>

 

<fjx:FileUploader ID="FileUploader2" runat="server"

>

<font size="3">

 

</font>

 

<Adapters

>

<font size="3">

 

</font>

 

<fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder"

/>

<font size="3">

 

</font>

 

</Adapters

>

<font size="3">

 

</font>

 

</fjx:FileUploader>

 

<font size="3">

 

</font>

 

<fjx:FileUploader ID="FileUploader1" runat

="server">

<font size="3">

 

</font>

 

<Adapters

>

<font size="3">

 

</font>

 

<fjx:DirectAmazonUploader

<font size="3">

 

</font>

 

AccessKey

="WebConfig:AmazonAccessKey"

<font size="3">

 

</font>

 

SecretKey

="WebConfig:AmazonSecretKey"

<font size="3">

 

</font>

 

BucketName="test.digitalanddirect.com"

/>

<font size="3">

 

</font>

 

</Adapters

>

<font size="3">

 

</font>

 

</fjx:FileUploader

>

 

<font size="3">

 

</font>

 

</asp:View

>

 

<font size="3">

 

</font>

 

</asp:MultiView

>

<font size="3">

 

</font>

 

</form

><font size="3" color="#0000ff"><font size="3" color="#0000ff">

</

</font></font><font size="3" color="#0000ff">

 

</font>

 

body

><font size="3" color="#0000ff"><font size="3" color="#0000ff">

</

</font></font><font size="3" color="#0000ff">

 

</font>

 

html

>

-----------------------

.cs

-----------------------

 

 

 

 

 

 

 

 

 

 

 

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

using

</font></font><font size="3" color="#0000ff">

 

</font>

 

System;

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

using

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

System.Collections.Generic;

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

using

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

System.Web;

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

using

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

System.Web.UI;

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

using

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

System.Web.UI.WebControls;

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

using

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

System.Diagnostics;

<font size="3" color="#0000ff"><font size="3" color="#0000ff">

public

</font></font>
<font size="3" color="#0000ff">

 

</font>

 

partial class _Default : System.Web.UI.Page

{

<font size="3">

 

</font>

 

protected void Page_Load(object sender, EventArgs

e)

{

<font size="3">

 

</font>

 

if (Request["HiddenView"] == "1"

) SetView();

}

<font size="3">

 

</font>

 

protected void Button1_Click(object sender, EventArgs

e)

{

SetView();

}

<font size="3">

 

</font>

 

public void

SetView()

{

MultiView1.SetActiveView(View2);

}

}

Coordinator
Jun 30, 2009 at 5:45 PM
Edited Jun 30, 2009 at 5:56 PM

No, this is not a bug of the control.

If you use it within other containers it is your responsability to make sure the control has been initialized in time.

An example of how to do that in your particular case follows:

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.DirectAmazonUploader" %>
<script type="text/C#" runat="server">
protected override void OnInit(EventArgs evt){
  base.OnInit(evt);
  if(Request.QueryString["__ID"] == "window."+FileUploader1.ClientID+"_DirAmz"){    
this.MultiView1.ActiveViewIndex = 1; } } protected void Button1_Click(object sender, EventArgs e){ this.MultiView1.ActiveViewIndex = 1; } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:HiddenField ID="HiddenView" runat="server"/> <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0"> <asp:View ID="View1" runat="server"> <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Go To Multiview 2" /> </asp:View> <asp:View ID="View2" runat="server"> <fjx:FileUploader ID="FileUploader2" runat="server"> <Adapters> <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder"/> </Adapters> </fjx:FileUploader> <fjx:FileUploader ID="FileUploader1" runat="server"> <Adapters> <fjx:DirectAmazonUploader AccessKey="WebConfig:AmazonAccessKey" SecretKey="WebConfig:AmazonSecretKey" BucketName="test.digitalanddirect.com"/> </Adapters> </fjx:FileUploader> </asp:View> </asp:MultiView> </form> <body> <html>
Jul 2, 2009 at 2:15 PM

Thank you,

That has worked.