How to assign a value to a variable and use it for another action in MVC Razor

I have a Kendogrid with filters, search calls, etc. For any action applied to the grid, such as paging, filtering, etc., the following action was called.

/// <summary> /// Returns the Manager List numbers. /// </summary> /// <param name="request">DataSourceRequest</param> /// <returns>JSON object</returns> public ActionResult GetCases([DataSourceRequest] DataSourceRequest request) { //some code } 

My view also has a text box and a button. When I enter any number in a TextBox, JQuery is called and an AJAX call is made, which calls a different action method in the same controller.

Now my question is how can I get the query “[DataSourceRequest] DataSourceRequest” in this [SelectRecords] action with earlier values ​​(the values ​​that are set when the filter is applied).

Note: Here, in SelectRecords, I got the Null values, not the values ​​set in Filter.

 public ActionResult SelectRecords(Int32 noOfRecords, [DataSourceRequest] DataSourceRequest request) { //Some code } 
+4
source share
1 answer

The DataSourceRequest request object changes every time a request is made.

In order to have the same request values, you must send the same request.

you can find an example request below use the same argument when calling the SelectRecords method on the client side, and you will begin to receive the same request object

+2
source

Source: https://habr.com/ru/post/1501987/


All Articles