08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 13 ■ <strong>AJAX</strong> SCRIPTS AND SERVICES 329<br />

If you specified that the properties could be writable, then you could save the properties<br />

using the save method that is exposed by the Profile service. In a similar manner to<br />

the load method you saw earlier, it takes four properties:<br />

propertyNames: String array containing the names of profile properties to save; can<br />

be null.<br />

saveCompletedCallback: Callback function to call upon profile saving<br />

failedCallback: Callback function to call upon failure of profile saving<br />

userContext: String information to pass to the callback functions<br />

Thus, you can specify how to save out your profile information using the following<br />

code:<br />

Sys.Services.ProfileService.properties.Property1 = document.form1.txtP1.value;<br />

Sys.Services.ProfileService.properties.Property2 = document.form1.txtP2.value;<br />

Sys.Services.ProfileService.save(null, OnProfileSaveCompleted, null, null);<br />

Summary<br />

In this chapter, you looked at how the <strong>AJAX</strong> extensions for <strong>ASP</strong>.<strong>NET</strong> h<strong>and</strong>le scripts <strong>and</strong><br />

services. You looked at the ScriptManager component in some detail, looking at how to<br />

h<strong>and</strong>le partial page updates <strong>and</strong> errors in partial page updates, before moving on to<br />

managing custom JavaScript libraries using the ScriptManager control. You then went<br />

into some detail on accessing the web services using the ScriptManager <strong>and</strong> how Ajax<br />

uses JavaScript Object Notation (JSON) to provide script-based proxies to web services.<br />

Finally, you looked at <strong>ASP</strong>.<strong>NET</strong> authentication, membership, <strong>and</strong> profiling, <strong>and</strong> how the<br />

<strong>AJAX</strong> extensions provide services that allow the JavaScript developer to access their information.<br />

In the next chapter, you’ll see how the <strong>AJAX</strong> extensions beef up the JavaScript<br />

developer’s toolbox through object-oriented extensions <strong>and</strong> more.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!