Adds a property and value to the client side object to be rendered into JavaScript code. VariableName becomes a property on the object and the value will be properly converted into JavaScript Compatible JSON text.
public void Add(string variableName, object value)
Parameters
variableName
The name of the property created on the client object.
value
The value that is to be assigned. Can be any simple type and most complex
objects that can be serialized into JSON.
Example
<<code lang="C#">>ScriptVariables scriptVars = new ScriptVariables(this,"serverVars"); // Add simple values scriptVars.Add("name","Rick"); scriptVars.Add("pageLoadTime",DateTime.Now); // Add objects AmazonBook amazon = new AmazonBook(); bookEntity book = amazon.New(); scripVars.Add("book",book); <</code>>
Overloads:
See also:
Class ScriptVariables© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic