Here's a challenging question I have. I'm working with a Telerik Grid that has some ClientSide Events:
.ClientEvents(events => events
.OnDataBinding("SetAjaxParameter")
)
Within the SetAjaxParameter
function, I am setting parameters for ajaxBinding:
function SetAjaxParameter(event) {
event.data = {
name: $('#paramterID').val(),
value: $('#valueID').val()
};
};
Now, in my controller, I can access the passed parameters 'name' and 'value'. However, I want to call SetAjaxParameter() in JavaScript rather than setting it up in the TelerikGrid configuration. Is there a way to achieve this? I need to obtain the event object passed by the Grid to my function, but I'm struggling to identify what type of object it is and how to retrieve it.
You might be wondering why I want to do this: I aim to separate cshtml and javascript files, with the javascript loading after the html content. As a result, the function for the databinding Event is not yet available.