Exemplo n.º 1
0
 /// <summary>
 /// Adds a template binding attribute to the element with a foreach attribute for iteration. pass in an empty value to ignore that setting
 /// </summary>
 public TagBuilder bindTemplate(string templateId, string data, string forEach, string afterAdd, string beforeAdd, string templateOptions)
 {
     var templ = new JSObject();
     templ.Add("name", JSBuilder.GetString(templateId))
          .AddIfNotEmpty("data", data)
          .AddIfNotEmpty("foreach", forEach)
          .AddIfNotEmpty("afterAdd", afterAdd)
          .AddIfNotEmpty("beforeAdd", beforeAdd)
          .AddIfNotEmpty("templateOptions", templateOptions);
     return bindTemplate("template", templ.ToString());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Adds a property to the json object. It asumes that it is not a string so it ouputs the value directly. 
 /// if the value is empty then it oupts null as the value for the property. You can nest JSObjects by
 /// adding a property to it, and passing as the value the ToString method call of another JSObject
 /// </summary>
 /// <param name="name">Property name {name}: {value}</param>
 /// <param name="value">Property value</param>
 public JSObject Add(string name, JSObject value)
 {
     if (value == null) return this;
     return Add(name, value.ToString(), ValueTypeEnum.Other);
 }