ProfileService Class Load Method

Listing 3. The ProfileService class's load() method can be used to load personalized settings using the ASP.NET profile provider.

function LoadProfile()
{
   Sys.Services.ProfileService.load(
     null, OnLoadCompleted, OnProfileFailed, null);
}

function OnLoadCompleted(numProperties, 
  userContext, methodName) {
    var name = Sys.Services.ProfileService.properties.Name;
    $get("txtName").value = name;    
}

function OnProfileFailed(error, userContext, methodName)
{
    alert("Save failed: " + error.get_message());
}