Hello experts,
First, I must say that the MVC Grid and Panel have been terrific timesavers. I've been able to put together an MVC project very quickly facing a tight deadline. However, I still consider myself a 'newbie' with MVC although I'm learning fast. My question will reveal a deficit of knowledge regarding postback and ajax - I come from the WebForms world. Hopefully, you can set me straight regarding best practice.
This is the architecture:
SearchController retrieves data and fills a Telerik grid. Rows are selectable in the grid. When a row is selected, I want to access the DataKey (AccountId) and pass that key to an action in EchoController.
On the grid I'm using:
.ClientEvents(events => events.OnRowSelected("onRowSelected"))
The javascript looks like this:
function onRowSelected(e) {
var AccountId = e.row.cells[0].innerHTML;
alert(AccountId);
$.ajax({ type: "POST",
url: "/Echo/GetPatientData",
datatype: "json",
traditional: true,
data: AccountId,
data: { 'AccountId': AccountId }
});
}
The post does work, however, I'm not able to display the SearchResults view in the Echo controller. This strategy obviously is flawed.
Question: What is the right way to accomplish this?
Thanks!
Arnold