or
<string xmlns="http://yaddayaddayadda.com/"> [{"title":"Stuff","value":"Here's some stuff"}]</string>[WebService(Namespace = "http://yaddayaddayadda.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] [ScriptService] public class websiteWebService : System.Web.Services.WebService { [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string GetStuff(int stuff_id) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["stuff"].ConnectionString); connection.Open(); SqlCommand command = new SqlCommand("o_get_stuff", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@stuff_id", stuff_id); SqlDataReader dr = command.ExecuteReader(); DataTable dt = new DataTable("Stuff"); dt.Load(dr); dr.Close(); connection.Close(); List<Dictionary<string, object>> rows = new
List<Dictionary<string, object>>(); Dictionary<string, object> row = new
Dictionary<string, object>(); foreach (DataRow datarow in dt.Rows) { row = new Dictionary<string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, datarow[col]); } rows.Add(row); } JavaScriptSerializer serializer = new JavaScriptSerializer(); string jsonData = serializer.Serialize(rows); return jsonData; } }}<script type="text/javascript"> $(document).ready(function () { $("#stuffSelector").kendoDropDownList({ dataTextField: "title", dataValueField: "value", dataSource: { transport: { read: { contentType: "application/json", type: "POST", url: "http://localhost:23035/Services/websiteWebService.asmx/GetStuff", data: { stuff_id: "0" } } } } }); }); </script><script id="WorkOrderGridRowTemplate" type="text/x-kendo-template"> <tr> <td> ${workorderreference} </td> <td> ${clientdestination} </td> <td> ${productreference} </td> <td> ${orderquantity} </td> <td> ${unitofmeasure} </td> <td> ${releasedate} </td> <td> ${quotedduedate} </td> <td> ${currentsequenceindex} </td> <td> # if (bufferpenetrationpercentage > 100) { # <span class="bufferPenetrationBlack">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage > 66) { # <span class="bufferPenetrationRed">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage > 33) { # <span class="bufferPenetrationYellow">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage > 0) { # <span class="bufferPenetrationGreen">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage <= 0) { # <span class="bufferPenetrationBlue">${bufferpenetrationpercentage}</span> # } else { # ERROR: ${ bufferpenetrationpercentage } # } # </td> </tr> </script>$("#divWorkOrderGrid").kendoGrid({ dataSource: { data: <%= _JsWorkOrderRecords %> }, rowTemplate: kendo.template($("#WorkOrderGridRowTemplate").html()), height: "auto", scrollable: false, sortable: true, groupable: true, pageable: false, columns: [ { field: "workorderreference", title: "W/O Ref." }, { field: "clientdestination", title: "Client/Destination" }, { field: "productreference", title: "Product Ref." }, { field: "orderquantity", title: "Order Quantity" }, { field: "unitofmeasure", title: "UoM" }, { field: "releasedate", title: "Release Date" }, { field: "quotedduedate", title: "Quoted Due Date" }, { field: "currentsequenceindex", title: "Current Sequence Index" }, { field: "bufferpenetrationpercentage", title: "Buffer Penetration (%)" } ] }); function playVideoNow() { jwplayer("details-container").setup({ file: "https://www.contoso.com/example.m4v", image: "https://www.contoso.com/example.png"}); <script type="text/x-kendo-template" id="template"> <div id="details-container"> <h2>Video Name</h2> <em>Video Date</em> <dl> <dt>Some Info: </dt> <dt>Some More Info:</dt> </dl> </div># window.onload = playVideoNow() # </script>.k-splitter { height: 300px; position: relative;}
01.var div = $("#divColours");02.var oid = "12312312", rnd = ((new Date()).getTime()).toString();03.div.kendoTreeView({04. dataTextField: "label",05. dataSource: new kendo.data.DataSource({06. type: "json",07. serverFiltering: false,08. transport: {09. read: function (options) {10. $.ajax({11. url: "Controllers/GenericController.ashx?rnd=" + rnd,12. dataType: "json",13. data: { "parms": ko.toJSON({ cmd: "coloursroot", sysoid: oid }) },14. contentType: "application/json; charset=utf-8",15. success: function (payLoad) {16. if (payLoad.Success) {17. var i = ko.toJSON(payLoad.Items);18. options.success(i);19. } else {20. };21. },22. error: function (jqXHR, textStatus, errorThrown) {23. debugger;24. },25. complete: function () {26. }27. })28. } //read29. },30. schema: {31. model: { hasChildren: false }32. } //transport33. }) //datasource34.});