Before you get started you need to familiarize yourself with a few concepts.

The ClientSideVariable attribute
Place this on a public property to mark it as serializable.

The JsConverter attribute
Place this on a public property that is marked as a ClientSideVariable to indicate the availability of a converter to transform the return type of the property to the JavaScript compatible representation. This is only necessary for complex types. Primitives are supported without the need for specifying a converter.

The IJsConverter interface
The interface all converters must implement to be compatible with the JsApi

The JsFunction attribute
Place this on a public method to mark it as serializable.

Methods marked with the JsFunction attribute must return a type of JsOperation and can take in one or more parameters of type DialectSoftware.Web.JsAPI.var. JsFunctions are a combination of C# and string concatenation that is fed into a function object through the AddOperation method. The function object, a reference to the containing class and the method parameters are then fed into the JsOperation object before it is returned from the method.



When dealing with the JsApi methods and properties standard C# syntax can be used:

this.OnChange(value, this.GetJsType().ClientID)
Use this syntax to emit the complete client-side method invocation with parameters

Use this syntax to emit the complete client-side property accessor. (Think of GetJsType() as reflection for the client-side object graph.)

this.GetJsType().OnFilter use this syntax to emit method stubs for client-side event delegation even use the syntax in the ascx file <%=this.Initialize()%>

With this information and using the demo as a guide you should not only be able to discern what's going on but start to take advantage of the functionality available in these libraries. On the client I am leveraging the Prototype framework 1.6.0 , Scriptaculous 1.8.0, and a few custom plugins I cobbled together from the internet. However, you can choose to code to any library you like Prototype, JQuery or otherwise.


Last edited Nov 7, 2012 at 9:04 AM by ekeratbellsouth, version 12


No comments yet.