Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Wednesday, March 28, 2012

AJAX UpdatePanel - Textbox focus question - simple example

I have run across an issue recently while incorporating AJAX into one of my applications. The issue demonstrates either my fundamental lack of understanding about how this technology works, or a problem in my implementation of it. I have created an bare-bones simple example to demonstrate what I'm seeing. I know how to remedy the problem, but I'd prefer the discussion center around *WHY* it's happening.

Here are the details. Consider a project with a default.aspx. That page has two controls, Button1 and PlaceHolder1. The project also contains as usercontrol, uc1.ascx, which simply contains a TextBox control, TextBox1. The click event of Button1 dynamically loads uc1 into the placeholder via the Page.LoadControl method. All I really want to do is set focus to to TextBox1 after the control is loaded. Without the UpdatePanel, I can do it two ways. I can either put TextBox1.Focus(); in UC1's page load event, or I can register a startup javascript to find the textbox and use its focus() method. Either way works fine. See example code below.

Now introduce UpdatePanel. Enclose Button1 and PlaceHolder1 in the same UpdatePanel. The result, no focus to the textbox. Move Button1 outside of the UpdatePanel, focus will work. Fundamental question is - WHY? Why does it matter where that button control is in relation to the Placeholder and UpdatePanel. I've done a lot of searching on this topic and I've found lots of questions but not many answers. Here's the code I'm using, to get focus to work correctly, move Button1 outside of the UpdatePanel:

Default.aspx

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Load UC1" OnClick="Button1_Click" />
<br />
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Button1_Click Event:

protected void Button1_Click (object sender, EventArgs e)
{
Control ctrl = new Control();
this.PlaceHolder1.Controls.Clear();
ctrl = Page.LoadControl("uc1.ascx");
ctrl.ID = "DynamicCtrl";
this.PlaceHolder1.Controls.Add(ctrl);
}

uc1.ascx:

<%@dotnet.itags.org. Control Language="C#" AutoEventWireup="true" CodeFile="uc1.ascx.cs" Inherits="uc1" %>
UserControl 1 <br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

uc1.ascx.cs:

using System;
using System.Web.UI;

public partial class uc1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
//use either of these two lines in the example
//this.TextBox1.Focus();
ScriptManager.RegisterStartupScript(this, typeof(UserControl), "focus", "document.getElementById('DynamicCtrl_TextBox1').focus();", true);
}
}

OK, now I'm really annoyed and I'm punchy enough to reply to my own posts. In reading a multitude of UpdatePanel/focus related threads, I found a snipped of javascript code that I though I'd try. I inserted the following section of code in the default.aspx contained in my original post. First I inserted it in the head section of the page and that resulted in the dreaded 'Sys' is undefined message. Then I moved the javascript *below* the scriptmanager and the page loaded with no errors. Here's the code I now have inserted in default.aspx just before the end form tag:

<scripttype="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(pageLoaded);
function pageLoaded(sender, args)
{
if (args.get_panelsUpdated().length > 0)
{
$get('DynamicCtrl_TextBox1').focus();
}
}
</script>

So here's what is making me punchy. I try the page in IE 6 & 7, no focus to the textbox. Try in FireFox, *FOCUS WORKING CORRECTLY*!! Now that's annoying. Could someone please take a stab at either reproducing what I'm seeing or possibly explaining it?? Thanks.

...BillH


I am developing a liking to responding to my own posts - makes me feel loved.

OK, so a few minutes ago I tried something that made my above scenario work. Don't know why, but now I have textbox focus in both IE and Firefox and the solution fits within the context of the project I'm working on. I don't need any startup scripts or Focus() methods on the textbox control.

What I did was create a public accessor for TextBox1 in the user contol codebehind as such:

public TextBox t
{
get
{
return this.TextBox1;
}
}

Then I added the following one line to the Button1 click event (after the dynamic control is added to the placeholder):

this.ScriptManager1.SetFocus(((uc1)ctrl).t.ClientID);

Viola. Textbox focus in both IE7 and Firefox. No idea why, take it for what it's worth.

...BillH


Thank you so much!

I've been working on this issue for a while now... I couldn't get any of my TextBoxes inside any UpdatePanels to set focus.

The solution seems like you just have to set the focus like this:

this.ScriptManager1.SetFocus(TextBox1);

and voila it works.


Yep, that works when your textbox is on the page that's loaded. In my case, it was in a user control that was being dynamically loaded via button click events. At any rate, while your above sample would work when the control is within the same form as the ScriptManager, I would strongly suggest you explicitly pass the SetFocus method the ClientID of the control:

this.ScriptManager1.SetFocus (this.TextBox1.ClientID);

In that way if you go back and reuse this code somewhere and you have a textbox on a usercontrol or within some other dynamically loaded control it would still work.

...BillH


Many many thanks for your inputs! It really worked!Smile

AJAX treeview control

Does anyone have an example of building a dynamic checkbox treeview control using AJAX? I'd appreciate any pointers.

Thx,

-M

Treeviews aren't supported by the UpdatePanels in the current release of ASP.NET Ajax. I have heard that you can do this in the render event, but it would be very hacky. There are some 3rd party controls that handle that.

Monday, March 26, 2012

AJAX Toolkit Documentation

I failed to find any complete official documentation on AJAX toolkit which will for example discribe AJAX DOM Utility..?? Also there are many examples in creating Extenders... but there are no examples of creating Controls (I mean that they are inherited from AJAX Toolkit ControlBase class) Can anybody give me an example of using AJAX Toolkit Control Base class?

scuko:

for example discribe AJAX DOM Utility..??

I'm sorry to tell that a full documentation isn't available yet.

scuko:

an anybody give me an example of using AJAX Toolkit Control Base class?

Please refer to this:http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/CreatingNewExtender.aspx


Raymond Wen - MSFT:

I'm sorry to tell that a full documentation isn't available yet.

And when it will be available? I thought that Toolkit is officially Released?


Please keep track of this item:

http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7433

Saturday, March 24, 2012

AJAX TaskList example and ASPNETDB.MDF

I have downloaded and installed ASP.NET Ajax Sample applications from

http://ajax.asp.net/default.aspx?tabid=47&subtabid=471

I am trying to run the AJAX TaskList example under C:\Program\Microsoft ASP.NET\ASP.NET AJAX Sample Applications\v1.0.61025\TaskList

First I moved the content of the TaskList folder to a virtual IIS directory, making it possible to debug the website on my local IIS server.

When I run the example I get prompted to Login or register as a new user. When I submit the registration form I receive the following error message:

Failed to update database "C:\INETPUB\WWWROOT\TASKLIST\APP_DATA\ASPNETDB.MDF" because the database is read-only.

I would appreciate some assistance. Is it possible for me to change the permissions forASPNETDB.MDF in order to run the TaskList example?

Thanks

Additional information:

I have installed SQL Server Management Studio Express as I figured this tool might help me to change the permissions. It did not help. I also tried to delete ASPNETDB.mdf, and recreate it by going Website -> Asp.net configuration by adding a new user. I still receive the same error message.

When I point the connection string to a remote SQL database of mine it is possible to register users in ASPNETDB.mdf. But I havn't figured out how to add users using a local version of ASPNETDB.mdf.

I am running Visual Studio on Windows XP. In windows XP you can't just modify permissions for folders as far as I know. I have recently installed SQL Server Management Studio Express as I said before.

I read somewhere that the read/write property for ASPNETDB.mdf may be enabled by checking a box somewhere.

But in SQL Server Management Studio Express tried the following:

*Right click on databases and click attach

*Click Add and select the database ASPNETDB.mdf

*Click OK

*Right Click on the path for ASPNETDB.mdf and click properties

When I click 'Options' under select a page Database Read-Only is already set to false.

If there is no way to use a local version of ASPNETDB.mdf (located to the App_Data folder) I simply have to put up with my remote MS SQL 2005 database. But the subscription fee for this database is outrageous, and therefore I hope that someone might help me and everyone else by providing the appropriate steps to use ASPNETDB.mdf located to the App_Data folder.

Thanks
Svenbro

Ajax Tabs not showing properly

I have tried implementing the tabcontainer using the example, and for some reason I cannot get the tabs to show properly. For some reason there is a grey box in each of the tabs which covers exactly half of every tab. Is there a style I need to add to fix this?

This a link to an image of what I am talking about:

http://shutter7.com/coppermine/displayimage.php?pid=2499&fullsize=1

Tabs

Hi there,

For some reason, the use of ajax tab, your aspx are require to be xhtml validate.

Put following line in your aspx page. It will fixes the issue. Hope it helps!

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">


That fixed it, but now all of my pages with css styles are now messed up. For example: the same class for a font is working in one row and not the other.


Hi jwhite128,

I've had this problem too. I was able to solvethis using simple workaround: I just overwrote the CSS class style withmy own implementation which then I included directly in my applicationas CSS resource. I even can reproduce the original "XP" style of theTabContainer by just copying the relevant images in my application'sThemes folder.

So my suggestion: create new Tabs style andimplement whatever visual behavior you need, then just set the CssClassattribute of the TabContainer extender.

Kind regards,

sbogus.


I've tried looking for the class names... where are some docs that contain the class names in question?


Hi jwhite128,

There's no direct documentation about which CSS classes you can override and how to do that. There's rather than information spread over several source files from the AjaxControlToolkit source three. You should look at the Tabs subfolder (not the one from the Examples!)

These are the CSS classes you can override in a CSS file ("new" is the name of the style I choose for this post, you should then specify the TabContainer's attribute CssClass="ajax__tab_new" to override the CSS style):

/* inactive tab */
.ajax__tab_new .ajax__tab_header
.ajax__tab_new .ajax__tab_outer
.ajax__tab_new .ajax__tab_inner
.ajax__tab_new .ajax__tab_tab
/* active tab */
.ajax__tab_new .ajax__tab_active .ajax__tab_outer
.ajax__tab_new .ajax__tab_active .ajax__tab_inner
.ajax__tab_new .ajax__tab_active .ajax__tab_tab
/* tab hover */
.ajax__tab_new .ajax__tab_hover .ajax__tab_outer
.ajax__tab_new .ajax__tab_hover .ajax__tab_inner
.ajax__tab_new .ajax__tab_hover .ajax__tab_tab
/* tab's body */
.ajax__tab_new .ajax__tab_body

Kind regards,

sbogus.


This is for anyone who implements<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> and finds that all of their classes and style sheets get messed up.

The classes in your page become case sensitive. So make sure you check the cases of your classes or else they will appear to be all jacked up.

ajax tabs

I am looking for an example that populates the tabs with data from a database?

Dave

If you're doing it server-side, you can just put any server control there and then bind it in the codefile like any other database binding.

If you're doing it clientside, you can call a webmethod (web service or pagemethod) and have your 'OnSuccess' function fill it using the html element's innerHTML property.

Both techniques are well documented.

Wednesday, March 21, 2012

AJAX Slideshow using a dynamic Webservice to display images

Hi there,

I have just managed to get the example slideshow working within my own project. I would like to take it a step further by using a database and a folder within my site to display selected images.

Let me try explain.

For the ease of explaining things lets say a user adds their UserID into a textbox and pressing a button. I then have a select statement that gets all the image names for that user. The webmethod then uses those names from the SELECT statement to loop through the folder which contains the images and then displays the images within the slideshow.

The current web method looks like this

public static AjaxControlToolkit.Slide[] GetSlides() {return new AjaxControlToolkit.Slide[] {new AjaxControlToolkit.Slide("/images/Blue hills.jpg","Blue Hills","Go Blue"),new AjaxControlToolkit.Slide("/images/Sunset.jpg","Sunset","Setting sun"),new AjaxControlToolkit.Slide("/images/Winter.jpg","Winter","Wintery..."),new AjaxControlToolkit.Slide("/images/Water lilies.jpg","Water lillies","Lillies in the water"),new AjaxControlToolkit.Slide("/images/VerticalPicture.jpg","Sedona","Portrait style picture")}; }

As you can see everything is hard coded with the images and the comments and names.

Has anyone done something like this before?

Any advise or tips would be really helpful.

Thanks Shane

Check out forum posthttp://forums.asp.net/thread/1608950.aspx. It talks about passing in user context to retrieve images from the database.

Ajax SlideShow Help

Can Someon help me to convert C# to Vb this web service code from SlideShow example? I already tried conversion tools and it gives me some errors. Thank You All.

<

scriptrunat="Server"type="text/C#">

[System.Web.Services.

WebMethod]

[System.Web.Script.Services.

ScriptMethod]publicstatic AjaxControlToolkit.Slide[] GetSlides()

{

returnnew AjaxControlToolkit.Slide[] {new AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"),new AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"),new AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."),new AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"),new AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")};

}

</script>

<System.Web.Services.WebMethod()> _

<System.Web.Script.Services.ScriptMethod()> _

PublicSharedFunction GetPictures()As AjaxControlToolkit.Slide()ReturnNew AjaxControlToolkit.Slide() { _New AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"), _New AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"), _New AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."), _New AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"), _New AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")}

End

Function

Ken Tucker:

<System.Web.Services.WebMethod()> _

<System.Web.Script.Services.ScriptMethod()> _

PublicSharedFunction GetPictures()As AjaxControlToolkit.Slide()

ReturnNew AjaxControlToolkit.Slide() { _

New AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"), _

New AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"), _

New AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."), _

New AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"), _

New AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")}

EndFunction

Thank You Ken.


Ken Tucker:

<System.Web.Services.WebMethod()> _

<System.Web.Script.Services.ScriptMethod()> _

PublicSharedFunction GetPictures()As AjaxControlToolkit.Slide()ReturnNew AjaxControlToolkit.Slide() { _New AjaxControlToolkit.Slide("images/Blue hills.jpg","Blue Hills","Go Blue"), _New AjaxControlToolkit.Slide("images/Sunset.jpg","Sunset","Setting sun"), _New AjaxControlToolkit.Slide("images/Winter.jpg","Winter","Wintery..."), _New AjaxControlToolkit.Slide("images/Water lilies.jpg","Water lillies","Lillies in the water"), _New AjaxControlToolkit.Slide("images/VerticalPicture.jpg","Sedona","Portrait style picture")}

End

Function

How can I populate this array dynamically? For example, Read some folder with images and create an array?

ForEach sIn Directory.GetFiles(Server.MapPath("my_vacation"),"*.jpg")

Response.write ( Path.GetFileName(s) )

Next


I saw that you answered the dynamic file issue with

ForEach sIn Directory.GetFiles(Server.MapPath("my_vacation"),"*.jpg")

Response.write ( Path.GetFileName(s) )

Next

But how do I get it to dynamically use a value from an SQL table field.

My images have names such as R12345.jpg, R12345_2.jpg, R12345_3.jpg etc...

The listing_id field value is R12345 which would need to replace the "my_vacation" above.

How can I get this to work?

Thanks for your help!

Mike


Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MyData.ImagePath = Server.MapPath("~/Images")
Dim strUrl As String = Request.Url.ToString

MyData.Url = strUrl.Substring(0, strUrl.LastIndexOf("/")) & "/Images/"
End Sub


<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetPictures() As AjaxControlToolkit.Slide()
Dim di As New DirectoryInfo(MyData.ImagePath)
Dim s(di.GetFiles.Length - 1) As AjaxControlToolkit.Slide
Dim x As Integer = 0
For Each fi As FileInfo In di.GetFiles()
s(x) = New AjaxControlToolkit.Slide(MyData.Url & fi.Name, "", Path.GetFileNameWithoutExtension(fi.Name))
x += 1
Next
Return s
End Function
End Class

Public Class MyData
Private Shared _Path As String
Private Shared _Url As String

Public Shared Property ImagePath() As String
Get
Return _Path
End Get
Set(ByVal value As String)
_Path = value
End Set
End Property

Public Shared Property Url() As String
Get
Return _Url
End Get
Set(ByVal value As String)
_Url = value
End Set
End Property
End Class


AWESOME!

How can I get it to retrieve images at a url other that mine, such as:

http://www.xyz.com/images

Thanks,

Mike


If you have ftp access to the images you can try something like this.

<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetFtpPictures() As AjaxControlToolkit.Slide()
Dim ftp As FtpWebRequest = WebRequest.Create("ftp://ftp.xyz.com/images")
ftp.Credentials = New NetworkCredential("YourUserName", "YourPassword")
ftp.Method = WebRequestMethods.Ftp.ListDirectory
Dim wr As WebResponse =ftp.GetResponse
Dim sr As New StreamReader(wr.GetResponseStream)
Dim lst As New List(Of String)
Do While sr.Peek > 0
Dim strOut As String
strOut = sr.ReadLine
lst.Add(strOut)
Loop
Dim s(lst.Count - 1) As AjaxControlToolkit.Slide
Dim x As Integer = 0
For Each str As String In lst
Dim i As Integer = str.IndexOf("."c)
s(x) = New AjaxControlToolkit.Slide("http://www.xyz.com/images/" & str, "", str.Substring(0, i))
x += 1
Next
Return s
End Function

Article on how to use photos stored in Flickr in a slide show

http://www.onteorasoftware.com/blog.aspx?BlogID=75


pashaKasim this site may help you. You may already know about it, but there might be someone out there who hasnt run across this tool yet.

http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx

J


Really usefull piece of code.I would like to use a slider control to move across page.For that to be implemented i need to move to the Nth image.Is there a method / way to move to the Nth image.ThanksRain Man Alex

AJAX slideshow gives me error Acme.SubAcme.ConvertMeTypeConverter cannot be found.

Hi there,

I have copied the slideshow example into my own project.
So I now have a folder called SlideShow. I copied the images folder over and also SlideShow.aspx,slide.cs,slideshowbehaviour.js,slideshowdesigner.cs,slideshowextender.cs

When I try opening the page I get a large popup box displaying the following error message.

--------
Windows Internet Explorer
--------
The server method 'GetSlides' failed with the following error: <html>

<head>

<title>Type: 'Acme.SubAcme.ConvertMeTypeConverter' cannot be found.</title>

<style>

body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}

p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

pre {font-family:"Lucida Console";font-size: .9em}

.marker {font-weight: bold; color: black;text-decoration: none;}

.version {color: gray;}

.error {margin-bottom: 10px;}

.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

</style>

</head>

<body bgcolor="white">

<span><H1>Server Error in '/AjaxShaneSite' Application.<hr width=100% size=1 color=silver></H1>

<h2> <i>Type: 'Acme.SubAcme.ConvertMeTypeConverter' cannot be found.</i> </h2></span>

<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

<br><br>

<b> Exception Details: </b>System.ArgumentException: Type: 'Acme.SubAcme.ConvertMeTypeConverter' cannot be found.<br><br>

<b>Source Error:</b> <br><br>

<table width=100% bgcolor="#ffffcc">

<tr>

<td>

<code>

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified usin…
--------
OK
--------

Does anyone know what I have done wrong?

Thanks for your help.

Shane

In your web.config have you uncommented the json serialization section? You will need to add a real converter in that section. This, Acme.SubAcme.ConvertMeTypeConverter, is just a "howto" placeholder.

<

system.web.extensions>

<

scripting>

<

webServices>

<!--

Uncomment this line to customize maxJsonLength and add a custom converter-->

<!--

<jsonSerialization maxJsonLength="500">

<converters>

<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>

</converters>

</jsonSerialization>

-->

<!--

Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate.-->

<!--

<authenticationService enabled="true" requireSSL = "true|false"/>

-->

<!--

Uncomment these lines to enable the profile service. To allow profile properties to be retrieved

and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and

writeAccessProperties attributes.

-->

<!--

<profileService enabled="true"

readAccessProperties="propertyname1,propertyname2"

writeAccessProperties="propertyname1,propertyname2" />

-->

</

webServices>

<!--

<scriptResourceHandler enableCompression="true" enableCaching="true" />

-->

</

scripting>

</

system.web.extensions>

Hi Kirtid

Yip I have uncommented that line. I copied over the webconfig from the example site into my own site.

This is the webconfig. I am really new to .NET & AJAX so I am not sure how what I need to do to add a real converter in that section

Thanks for your help

Shane

 <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <system.web> <trust level="Medium"/> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> </pages><!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="true"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies> </compilation> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules> <siteMap defaultProvider="SamplesSiteMap"> <providers> <add name="SamplesSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Web.sitemap"/><!-- <add name="WalkthroughsSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Walkthroughs.sitemap"/> --> </providers> </siteMap> <globalization culture="en-us" uiCulture="en"/> </system.web> <system.web.extensions> <scripting> <webServices><!-- Uncomment this line to customize maxJsonLength and add a custom converter --> <jsonSerialization maxJsonLength="50000"> <converters> <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> </converters> </jsonSerialization><!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --> <!-- <authenticationService enabled="true" requireSSL = "true|false"/> --> <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. --> <!-- <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> --> </webServices><!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> --> </scripting> </system.web.extensions> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </handlers> </system.webServer></configuration>

Shane,

You can use the web.config from the toolkit sample website for your stuff. We have it commented out in that file. Looks like you do not need to worry about Converters and you can safely keep it commented out. If you need more information you can take a look at some documentation onconverters.

Kirti


Hi again,

Sorrry if im sounding very simple here but I don't understand :( I have searched through the example site and there is only 1 reference toAcme.SubAcme.ConvertMeTypeConverter which is the web.config which is the same as mine.

However I get this popup.

Do I need to add this into the page load event?

// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration("/aspnetTest");

// Get the external JSON section.
ScriptingJsonSerializationSection jsonSection =
(ScriptingJsonSerializationSection)configuration.GetSection(
"system.web.extensions/scripting/webServices/jsonSerialization");

//Get the converters collection.
ConvertersCollection converters =
jsonSection.Converters;

if ((converters != null) && converters.Count > 0)
{
// Get the first registered converter.
Converter converterElement = converters[0];
}


You should just comment out that section. You do not need it if you are not dealing with Converters. Acme.SubAcme.ConvertMeTypeConverter is just a dummy placeholder that is actually commented out in the atlas web.config and in our sample website web.config as well. It is a "how-to" add a converters section to your web.config file sample. We recommend that you reuse the sample website web.config for starters.

Thank-you I do feel silly now.

This brings me to my next question so I think I will start a new thread.

Thanks again.

Shane