Showing posts with label explanation. Show all posts
Showing posts with label explanation. Show all posts

Wednesday, March 28, 2012

ProfileScriptService Explanation

Hi,

I'm trying to understand and know all new controls Atlas has. By now, I made some examples with AutoCompleteExtender and DragOverlayExtender and all work well.

But, 'm trying to do something with ProfileScriptService and I don't know how it works. I searched information in google, in some blogs for Atlas and found one post in asp.net forum telling about other control in which there is a ProfileScripService control declared. I tested this example but I can't understand the functionality of this control.

Can someone tell me something about ProfileScriptService??

Thanks.

I am in the same boat, I am trying to get the profile script service samples from the presentations on the web to work, but they just don't work. TTYL.

hello.

well, it's just a custom proxy which wraps calls made over a web service defined in the atlas dll. so, what can you do with it? well you can get or save the properties of your profile that have been atlas enabled. to enable a property to be used, you must add it explicitly to the profileService element in the web.config file.

then, on the client side, you get the profile info by calling the load method (btw, you should also add a handler to the loaded event so that you'll be notified when the properties are loaded). to save eventual property changes, you have 2 options: autosave (in this case, you don't have to do anything) or the manual save( calling the save method).

to explain all these aspects, here's a simple example. suppose your asp.net profile has these properties:

<profile enabled="true">
<properties>
<add name="Nome" type="System.String" />
<group name="Morada">
<add name="Rua" type="System.String"/>
<add name="Porta" type="System.String"/>
</group>
</properties>
</profile>

and you want to access all of them on the client side. so, you must also add these lines to activate the atlas profile service:

<profileService
enabled="true"
setProperties="Nome; Morada.Rua;Morada.Porta"
getProperties="Nome; Morada.Rua;Morada.Porta" />

and now, you can build a simple page to get them and change them. here's some simple html that defines the page structure:

<atlas:ScriptManager runat="server" ID="manager" />

<span>Primeiro nome:</span><input type="text" id="nome" />
<br />
<span>Rua:</span><input type="text" id="rua" />
<br />
<span>Porta:</span><input type="text" id="porta" />
<p></p>
<input type="button" id="modificar" value="Actualizar perfil" onclick="actualiza()" disabled="disabled" />

and here's the jscript that might be used with it:

Sys.Application.load.add( onload );
function onload( sender, eventArgs )
{
Sys.Profile.set_autoSave( false );
Sys.Profile.loaded.add( onProfileLoaded );
Sys.Profile.saved.add( onProfileSaved );
Sys.Profile.load();
}

the profile properties are loaded after the page has loaded everything. i've also disabled autosave and set 2 handlers for the loaded and saved events. During the loaded event, i fill the controls; during the saved event, i show an alert which says that everything has been sa

function onProfileLoaded( sender, eventArgs )
{
$("nome").value = Sys.Profile.properties.Nome;
$("rua").value = Sys.Profile.properties["Morada.Rua"];
$("porta").value = Sys.Profile.properties["Morada.Porta"];

$("modificar").disabled = false;
}

function onProfileSaved( sender, eventArgs )
{
alert( "Dados perfil guardados");
}

function actualiza()
{
Sys.Profile.properties["Nome"] = $("nome").value;
Sys.Profile.properties["Morada.Rua"] = $("rua").value;
Sys.Profile.properties["Morada.Porta"] = $("porta").value;

Sys.Profile.save();
}

btw, some important observations:

* the property group sintax must use the [ ] operator
* though you can use this service from xml-script, there's currently several limitations when you have proeprties and subproperties
* pay attention if you use datetime values

Monday, March 26, 2012

propertyChanged, DataAvailable, general questions/suggestions

1.
I've read through the quickstart guide and this forum without finding a good explanation of what these two properties do:
propertyChanged="onChanged"
<DataAvailable Handler="traceDataAvailable" />
2.
What exactly is happening when the method "evaluateIn" is called in a binding?
3.
Anybody know when more documentation and examples will be released? I'm interested to learn about the other visual effects Atlas can do. Maybe some examples from the AtlasUIGlitz.js script file would be useful?
Another useful example might be specifically how to minimize the number of round trips to a database using Atlas.
4.
Is it possible to eliminate postbacks when the query string value changes on a page using Atlas?
KeeganRe #1: propertyChanged is an event part of the INotifyPropertyChangedinterface. It should be raised whenever a value of a property changes.It is part of the infrastructure that allows for stuff like bindings.(*1)The dataAvailable event is raised whenever the data in the datasource is available (ie. when the service returned the results).
Re #2: The binding will be evaluated (with direction=in): the targetproperty's value will be set to the source property's value.(*1)

Re #3: I don't know, but if you haven't already checked outNikhilKothari's slides/demos he gave at PDC05, you should take a look atthat. He demonstrated several "glitz features".
Re #4: Not that I know of.
(*1)See also my blog post aboutbindings in Atlas.