Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Odd script error when using client script callbacks (ASP.NET 2.0)

Reply
Thread Tools

Odd script error when using client script callbacks (ASP.NET 2.0)

 
 
=?Utf-8?B?TG93bGFuZGVy?=
Guest
Posts: n/a
 
      03-27-2007
Hello,

I've built a web application that uses client script callbacks. It is used
on a large network with a large variety of user OSes and IE versions. It was
tested on IE 6 on different setups and IE 5.5 to a lesser degree without
problems.

I know of a least one user who gets an error in WebResource.axd when using
the application. The same error also occurs on a simple reproduction page
with just a button and a div. When the button is pressed, the return value
from the server is stored in the div's .innerHTML.

In WebResource.axd the error "'encodeURIComponent' is undefined". occurs at
the indicated line below.

function WebForm_EncodeCallback(parameter) {
if (encodeURIComponent) { <--------------------------------- here.
return encodeURIComponent(parameter);
}
else {
return escape(parameter);
}
}

I've been able to reproduce the error on a virtual machine running Windows
2000 with IE 5. The user involved however is using Windows 2000 with IE 6
(6.0.2800.1106co). I've tried searching for some text that explains why this
could be happening, but have come up empty. So if anyone is familiar with
this or knows the reason this could be happening I'd be glad to know.

Below I'll add the code for the reproduction page and codebehind.

Webform:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Web._Default" %>

<!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>Client callback test pagina</title>
<script language="javascript">
function ProcessReturnValue(response, context)
{
var textArea = document.getElementById("textArea");
textArea.innerHTML = response;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<p>
<input id="callbackButton" type="button" value="Server aanroepen"
runat="server" />
</p>
<div>
<div id="textArea" style="border: solid 1px black; height:
100px;"></div>
</div>
</form>
</body>
</html>

Codebehind:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Web
{
public partial class _Default : System.Web.UI.Page, ICallbackEventHandler
{
private string _result = "";

protected void Page_Load(object sender, EventArgs e)
{
string rpc = ClientScript.GetCallbackEventReference(this, null,
"ProcessReturnValue", "null", "null", false);
string js = String.Format("javascript:{0}", rpc);
callbackButton.Attributes["onclick"] = js;
}

#region ICallbackEventHandler Members

public void RaiseCallbackEvent(string eventArgument)
{
_result = "Text returned from the server.";
}

public string GetCallbackResult()
{
return _result;
}

#endregion
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd behavior with odd code Michael Speer C Programming 33 02-18-2007 07:31 AM
Client script callbacks not working outside Visual Studio aBs0lut30 ASP .Net 0 08-10-2006 07:49 PM
Client callbacks Papanii Okai ASP .Net 0 03-07-2006 07:05 AM
Problem using Client Side Callbacks in 2.0 =?Utf-8?B?TmV2ZXJseW4=?= ASP .Net 0 05-08-2005 04:10 AM
Client Side Callbacks for ASP.NET 1.x Lucas Tam ASP .Net 6 02-07-2005 01:41 PM



Advertisments