/// <summary> /// Used to send data back to browser. /// </summary> /// <param name="menuItems"></param> /// <returns> ///{"MenuItems": /// [ /// {"label": "Option1", "value": "1"}, /// {"label": "Option2", "value": "2"}, /// {"label": "Option3", "value": "3"}, /// ] ///} ///</returns> /// public static string ConvertMenuItemsToJSON(List <AutoSuggestMenuItem> menuItems, int totalResults) { XJsonWriter writer = new XJsonWriter(); WriteMenuItemsToJSON(menuItems, totalResults, writer); return(writer.ToString()); }
public string GetJSON() { XJsonWriter writer = new XJsonWriter(); writer.WriteNameValue("label", _label); writer.WriteNameValue("value", _value); writer.WriteNameValue("isSelectable", _isSelectable); writer.WriteNameValue("cssClass", _cssClass, true); return(writer.ToString()); }