I have a little tricky question. I have a Telerik Grid with some ClientSide Events:
.ClientEvents(events => events
.OnDataBinding("SetAjaxParameter")
)
In the function SetAjaxParameter I set the paramters for the ajaxBinding:
function SetAjaxParameter(event) {
event.data = {
name: $('#paramterID').val(),
value: $('#valueID').val()
};
};
So in my controller I have access to the passed parameters ‘name’ and ‘value’.
But I want to define the call to SetAjaxParameter() in javascript and not in the Setup of the TelerikGrid. Is that somehow possible? So i have to get this event-Objekt which is passed by the Grid to my function. But i can’t figure out what type of objekt it is neather how to get it.
You may ask why: i want to seperate cshtml and javascript files and my javascript gets loaded after the html has been loaded, so the function for the databinding-Event is not available yet
In the end, it’s pretty simple to to that. I just had to write following code snippet:
And on the next AjaxCall by the grid, the desired parameter get passed to my controller.