This question is locked. New answers and comments are not allowed.
I am having issues passing values to a controller action with Ajax client binding...
My binding is setup as:
If I setup a button with a click event to refresh the grid using the following javascript, my 2 action arguments have values...
However, because this is a click event, when the grid initially loads and the action parameters are blank. Therefore I started looking at the OnDataBinding Client Event...
If I remove the arguments from the .rebind above in the click event, wire up the client event, and implement the event as follows:
I found that on both the initial load and the click event, that this function is invoked, the e.Data is initially undefined and then set. However in both situations the controller action arguments are now null.
I even tried changing the e.Data assignment to:
To no avail...
I am running in a MVC3 web site and Telerik was installed via NuGet and is version 2011.3.1115. I am using the JQuery and jquery validate that shipped with Telerik along with other jquery libraries...
Any ideas why the onDataBinding is not working for me?
Additionally, when the parameters are sent with the rebind method, if I break in the controller action, I see the HttpContext.Request.Forms collection contains the 2 arguments as indexes 1 & 2 (0 is page). When set via e.Data, the HttpContext.Requests.Forms collection only contains 1 element (key=page)
My binding is setup as:
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("GetContractLineItems", "Adjustment")
)
If I setup a button with a click event to refresh the grid using the following javascript, my 2 action arguments have values...
$("#OrderItems").data("tGrid").rebind({ selectedDocumentOrders: items, tttest: "351331" });
However, because this is a click event, when the grid initially loads and the action parameters are blank. Therefore I started looking at the OnDataBinding Client Event...
If I remove the arguments from the .rebind above in the click event, wire up the client event, and implement the event as follows:
...
.ClientEvents(events => events.OnDataBinding("onDataBinding"))
...
function onDataBinding(e) {
var items = "";
... set items ...
e.Data = { selectedDocumentOrders: items, tttest: "351331" };
}
I even tried changing the e.Data assignment to:
e.Data = { "selectedDocumentOrders": items, "tttest": "351331" };
I am running in a MVC3 web site and Telerik was installed via NuGet and is version 2011.3.1115. I am using the JQuery and jquery validate that shipped with Telerik along with other jquery libraries...
Any ideas why the onDataBinding is not working for me?
Additionally, when the parameters are sent with the rebind method, if I break in the controller action, I see the HttpContext.Request.Forms collection contains the 2 arguments as indexes 1 & 2 (0 is page). When set via e.Data, the HttpContext.Requests.Forms collection only contains 1 element (key=page)