Click here to Skip to main content
15,914,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have a jqgrid that is loading from a "Client" controller's result ("/Clients/GetClients"),
which is loading correctly.

Now this is all within a partial page and what i would like to do is to allow the user to search for a particular client and have those results contained withing a model result and used to filter.

At the moment i am basically using the session data to store this until this URL is called "/Clients/GetClients" then the controller filters the results. But is there a way to pass this model data directly into the jqGrid's URL so that i do no not have to use the session data? If not then that is fine, or if there is a better way to do this then please feel free to comment.

hope it makes sense :)

JavaScript
// set up the grid and pager
this.client_grid = $("#client_grid").jqGrid(
{
    url: "/Clients/GetClients",
    datatype: "json",
    mtype: "POST",
    height: 250,
    colNames: ['Name', 'Description', 'Company', 'Address', 'Phone', 'Email', 'Date Created'],
    colModel: [
        { name: 'Name', index: 'Name', width: 200, align: "left", sortable: false },
        { name: 'Description', index: 'Description', width: 100, align: "left", sortable: false },
        { name: 'Company', index: 'Company', width: 100, align: "left", sortable: false },
        { name: 'Address', index: 'Address', width: 100, align: "left", sortable: false },
        { name: 'Phone', index: 'Phone', width: 70, align: "left", sortable: false },
        { name: 'Email', index: 'Email', width: 100, align: "left", sortable: false },
        { name: 'Created', index: 'Created', width: 90, align: "left", sortable: false }
    ],
    caption: "Clients",
    pager: this.client_pager
})


C#
[HttpPost]
public JsonResult GetClients(JqGridRequest request)
{
    ClientsModel model = null;
    model = new ClientsModel(request);
    return Json(model);
}
Posted

1 solution

try this post in my blog for posting value to Actionresult when drop down change
http://fromjami.wordpress.com/2013/07/12/post-data-to-the-action-result-in-jqgrid-and-asp-net-mvc/[^]
Hope this helps
 
Share this answer
 
Comments
Zerotimedev 13-Sep-13 2:36am    
that looks like what im after, thanks i will give it a crack shortly :)
Zerotimedev 14-Sep-13 5:35am    
Worked great thanx for the help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900