Nirav

But what if any of the additional parameter is optional? If we take your example then what if Id param is optional? How to handle it in
.Read(read => read.Action("Products_Read", "Grid", new { name = "test", id = 2 }))

In my example below I may or may not pass Id. Means Id could be any integer value or it could be null.
.Read(read => read.Action("Read", controllerName. new { Id = 3 }))

Nirav

I understood your solution provided that I have to implement it in controller.

But since it is an interger I cannot assign null in Ajax Read action mentiond below. It gives a compilation error.
.Read(read => read.Action("Products_Read", "Grid", new { Id = null}))

Either I have to give it a non zero value or it should be 0 (zero). In this case in my controller I have to explicitely check if Id is 0 then perform normal operation and if Id is non zero perform specific operation.

I can do it the way I have explained above but I am finding any logical and clear solution.

Dimiter Madjarov

If the parameter is defined as nullable in the controller and you don't want to pass it in the current scenario, you should just omit the RouteValues object.
E.g.

.Read(read => read.Action("Products_Read", "Grid"))

otherwise, you could add the Id with an integer value.
E.g.

.Read(read => read.Action("Products_Read", "Grid", new { Id = 5 }))

Nirav, it would be easier for us to provide you better support if we continue only one of the two threads (forum and support). If you need additional support, please reply only in the support thread or here in the forum if you think, that this information is useful for other customers too.

Nirav

If I omit the RouteValues it doesn't work.
Means for .Read(read => read.Action("Products_Read", "Grid")), if I pass the parameter or not, none of the below controller actions invoke.
public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request)
public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request, int id)

And if I use the below controller actions, each time whether I pass the id (in query string or as a parameter) or not, only the second action invokes.
public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request)
public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request, int? id)

I have closed the similar support ticket to allow discussion at one place and for all here on forum.

Atanas Korchev

How does the posted data looks like? You can find this by using the Network tab of your browser's developer tools. Most probably ASP.NET MVC default model binder cannot parse the data returned by jQuery serializeArray().

ITO

I have a similar question.
.Read(read => read.Action("action", "controller").Data("GetCommitteeSearchParam")) is not working in IE 10. In IE8 and chrome the same code is working fine without any issues. Once we upgraded to IE 10, it stopped working. The function "GetCommitteeSearchParam" is not reached, so parameters are not passed. Could you provide any alternate solution for this?

Luis

I am creating an editable grid in a view passing an integer model. I have configured edit, destroy and create actions. In every action I am passing back the integer model of the view to the controller. The Read, Update and Destroy actions are correctly passing this integer model. However, the Create action is not, even though it is defined in the same was as the others:

DHHS

I have grid on the button click , which takes parameters from viewbag. It works fine when first time loads. when i click the button for the different record, it still takes the same parameter values of the first one.

// this is how am refreshing the grid. This works fine for the first time for the first record. when i go back to another page and come back with some other parameter values, i can see the viewbag values or proper, but when i click the button read method has first time parameters.

Dimiter Madjarov

When the additional parameters are added in the Grid configuration as route values, they are attached to the read action URL.
E.g.

Grid/Orders_Read?contractId=1

so they will be send each time.

Another approach that you could try would be to omit them and use the Data() method to define a JavaScript function that will return the additional data for the request. This way you could include the custom logic for determining what values to be sent inside this function.
E.g.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.