10.02.2014 Views

Beginning Ajax With ASP.NET (2006).pdf

Create successful ePaper yourself

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

Try It Out<br />

Retrieving Profile Property Names<br />

Take a look at some code for getting the names of the properties from a profile.<br />

function GetProfile()<br />

{<br />

var profObj = Sys.Profile;<br />

profObj.loaded.add(OnGetProfile);<br />

profObj.load();<br />

}<br />

function OnGetProfile()<br />

{<br />

var propArray = Array();<br />

propArray = Sys.Profile.properties;<br />

if (null != propArray)<br />

{<br />

for(m in propArray)<br />

alert(m);<br />

}<br />

}<br />

How It Works<br />

Consider what happens in the code:<br />

1. An alias to the Sys.Profile class is created.<br />

2. The callback on completion is assigned to the method OnGetProfiles.<br />

3. The asynchronous call is made through the .load() method call.<br />

4. When the callback is made, the code gets the .properties property. The property contains the<br />

profile information for a user and the application.<br />

5. The code loops through the returned properties and displays them to the user.<br />

Figure 12-3 shows the output of getting the profile properties.<br />

Atlas Integration with <strong>ASP</strong>.<strong>NET</strong> Services<br />

Figure 12-3 321

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

Saved successfully!

Ooh no, something went wrong!