How to use json.js client side JavaScript file inside an AJAX.NET project

by APIJunkie 2/11/2008 8:12:00 AM
Sometimes it is necessary to mix json.js functions like toJSONString() with client script generated by the AJAX.NET library.

If you include the json.js file in your client script you might receive enumValueNotInteger error.

A little digging around landed me on the following helpful discussion at http://forums.asp.net/t/1077290.aspx

Steve Marx raises several options to solve the problem in the above discussion.

To solve my problem I used the script manager Scripts property option.

Example:

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

<Scripts>

   <asp:ScriptReference Path="json.js" />

</Scripts>

</ajaxToolkit:ToolkitScriptManager>

Note if you are using master pages or need json.js script inside custom controls you can use the script manager proxy Scripts property instead.

Example:

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">

<Scripts>

   <asp:ScriptReference Path="json.js" />

</Scripts>

</asp:ScriptManagerProxy>

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.NET | AJAX | JavaScript | JSON

Comments

2/11/2008 8:21:16 AM

trackback

Trackback from DotNetKicks.com

How to use json.js client side JavaScript file inside an AJAX.NET proj

DotNetKicks.com

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

11/19/2008 7:09:24 PM

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author

My name is Bacon…James Bacon.

I am an API wars veteran I was wounded by x86 assembly, recovered and moved on to C. I am currently stuck in C++ and sniffing .NET.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

E-mail me Send mail


Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Sign in