I'm new to web development. I am currently working on a ASP.NET MVC 2 project that needs to use a jqGrid to dis开发者_JAVA技巧play the results of a search.
Now every single jqGrid tutorial that I found has the grid filled by calling its own specific action in the controller. However, I have various search categories on my page, each with their own form that calls the appropriate action when submitted. Each action then returns a list of results.
Is there a way to populate the jqGrid using the view model that has been returned by one of the search actions? If so, could you specify a small example? If not, how can I populate the jqGrid when submitting search criteria by clicking the submit button?
Found another way. Upon submitting the action corresponding to the search category still gets used, but instead of returning the results it stores the results in the session cache:
HttpContext.Session["Response"] = _repository.search(criteria);
Then when the page refreshes, the jqGrid action gets used to retrieve the cached results and populates the grid.
精彩评论