The Temple of Fu

code, systems and games

Archive for the ‘Ajax’ Category

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Ajax Toolkit – Update Panel and Datagrid download button

with 8 comments

So I have a datagrid which is a listing of files in a network share. I have a linkbutton in the grid with its text property set to a filename. This datagrid sits inside an UpdatePanel so it is all ‘Ajaxified’. When testing the command on the link button I received the following error.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Now I do understand why I received this error, I had modified the output stream back to the client via AddHeader methods etc but I need to in order to get this file back to client!

Well fortunately there is a way to tell the Ajax parser code on the client that content coming back was modified on the server side via script manager and also by registering the datagrid as a postback control.

ScriptManager _scriptManager = ScriptManager.GetCurrent(this.Page); _scriptManager.RegisterPostBackControl(myDataGridID);

Hope this helps!!

Advertisements

Written by lordfu

September 24, 2010 at 2:11 pm

Posted in Ajax, ASP.Net, C#, Development

Install Ajax Control Toolkit – Visual Studio 2008

with 4 comments

When you create a new ASP.NET application or web-site in VS 2008 that targets the .NET 3.5 framework, VS will automatically add the appropriate AJAX registrations in your web.config file and the core ASP.NET AJAX server controls will show up in your toolbox. This post shows you how to register the rest of the extensions in VS 2008.

Download the Ajax Control Toolkit

Click the Downloads tab at the CodePlex site to see the list of available Ajax Control Toolkit downloads. If you are using Visual Studio 2010 then you can use either the .NET 4 or .NET 3.5 versions of the Ajax Control Toolkit.

Download the Binary version and not the Source version of the Ajax Control Toolkit. You should download the Source version of the Ajax Control Toolkit only when you are interested in extending the Ajax Control Toolkit.

Extract the Download
After downloading the Ajax Control Toolkit, you need to unblock and extract the files. Right-click the compressed file and click the Unblock button.

Next, right-click the compressed file and select the Extract All menu option.

Add the Ajax Control Toolkit to the Visual Studio Toolbox
The next step is to add the Ajax Control Toolkit to the Visual Studio Toolbox. Follow these steps:

1. Launch Visual Studio and create a new ASP.NET Web Forms project or website. Open Default.aspx in the Visual Studio editor.
2. Create a new Toolbox tab by right-clicking the Toolbox and selecting Add Tab. Name the new tab Ajax Control Toolkit.
3. Right-click beneath the new tab and select the menu option Choose Items… Click the Browse button and browse to the folder where you extracted the Ajax Control Toolkit. Pick the AjaxControlToolkit.dll and click the OK button to close the Choose Toolbox Items dialog.

Hope that helps!

Written by lordfu

July 14, 2010 at 4:13 pm

Posted in Ajax, ASP.Net, Development