Part 3: Implementing w2ui in ASP.NET – Remote Data Source
DRANK

In mylast post, I already shared how I do it with local data source, here I would like to share how I implement w2ui grid with remote data source.1. CONTROLLERUsing remote data source, w2ui grid needs to load data from the controller when user chooses to:sortsearchscroll up and down (when needed)For this purpose, I have created related functions in the controller.LoadRecordsThis is my main function to load records from database.I will show later how I call this function from w2ui grid.public string LoadRecords() { string filter = RequestQueryString(); IEnumerable<Task> records = db.Task .SqlQuery("SELECT * FROM Tasks " + filter); var jsonData = JsonConvert.SerializeObject(records); return jsonData; }RequestQueryStringThis function generates query string based on user request:protected string RequestQueryString(string query = "", string defaultorder = "Id") { string filter = query; var req = Request.Form["request"]; if (req == null) { return filter; } JObject r …

codeproject.com
Related Topics: Windows