Duration: 20:19 min
Summary: In this video, we move to populating a jqGrid from a web service. Since we started with the grid we have been using a local array with data to populate the grid and experiment with the available functionality. But in most scenarios, the data is not local. We usually get the data using web services. We will do that in this case. We start with creating the web service (an asmx service), and we will call the service and view the data in the next video. We add a new service to the web site. In the code behind, we set the correct using statements and create an employee class. In the service, we create a list of those employees. We add a method that gets all the employees. We also add the appropriate attributes to the method to format the data using json. In the method itself, we create an object that contains the data formatted the way the grid expect it to be (number of records…). Then, we use the javascript serializer to serialize the data in Jason format. Finally, we test the service to make sure the data returned is valid Jason. Next we will call the service to load the records into the grid…
Technologies and Resources: jQuery, jqGrid, Visual Studio 2010,Ajax, WebService, asmx, var, ScriptService, List, WebMethod, ScriptMethod, Context, Response, JavaScriptSerializer.