Welcome Guest Search | Active Topics | Members

Server Response Options
Maxx
Posted: Tuesday, June 20, 2006 3:33:16 AM
Rank: Member
Groups: Member

Joined: 6/20/2006
Posts: 3
Points: 3
Environment: asp.net C#

I have tried to write Response.Write("Error"); in the server side program (.cs) and catch the result by client side javascript (.aspx) as below.

Code:
if (Status=="COMPLETE"){
        if(StatusText == "Error"){
            alert("Error occurs");
        }
}


But it can't work, anybody help? The StatusText seems not equal to "Error".
Fedor
Posted: Tuesday, June 20, 2006 4:34:25 AM

Rank: Advanced Member
Groups: Administration , Member

Joined: 7/28/2003
Posts: 1,254
Points: -345
Location: WA, US
JavaScript string equality operator (==) is case-sensitive. So you should use "ERROR" string of "Error" one.

This code (syntax with iuembed.js) works for me:

Code:
iu.addEventListener("Progress", "ImageUploader_Progress");
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText){
      if (Status=="ERROR"){
            alert(StatusText);
      }
}


For testing I used following server-side code:

Code:
Response.Write ("Hello")
Response.StatusCode = 500


P.S. It seems [code] forum tag is broken and admin should fix it. :(

Best regards,
Fedor Skvortsov
Maxx
Posted: Tuesday, June 20, 2006 7:37:21 PM
Rank: Member
Groups: Member

Joined: 6/20/2006
Posts: 3
Points: 3
Thank you for your reply.

But still can't work for the following code on the client side:

Code:
if (Status == "ERROR"){
  alert(StatusText);
}


The StatusText displays a lot of the codes and seems can't terminate on the screen.

Do I need to clear something first for the response action?
uhleeka
Posted: Wednesday, June 21, 2006 2:12:29 PM
Rank: Member
Groups: Member

Joined: 6/21/2006
Posts: 1
Points: 0
I'm not sure if I understand completely, but if you are trying to generate only the string "Error" as the response, maybe the following will help:

Code:
Response.Clear();
Response.Write("Error");
Response.End();
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.