I believe I have done something similar to this, if I am understanding your question.
ASPX Page
<a class="open-modal" href="/MyFolder/MyView">Open Modal</a>
JavaScript
$(function () {
$('body').on('click', '.open-modal', function (e) {
e.preventDefault();
$.post(this.href, function (html) {
$('<div />').kendoWindow({
visible: true,
title: 'My Modal',
modal: true,
width: '600px',
deactivate: function () {
this.element.closest('.k-widget').remove();
}
}).data('kendoWindow')
.content(html)
.center()
.open();
});
})
});
MVC Controller Action
[HttpPost]
public PartialViewResult MyView()
{
var vm = new MyViewVM();
return PartialView("_MyView", vm);
}
Is that helpful at all?
UPDATE
Yea you can pass parameters. Just include them as querystring values on your <a>
and add them to the controller action.
<a class="open-modal" href="/MyFolder/MyView?id=9&name=Test">Open Modal</a>
then ...
[HttpPost]
public PartialViewResult MyView(int id, string name)
{
var vm = new MyViewVM();
//get data and fill view modal with id
return PartialView("_MyView", vm);
}
That should work just make sure your parameter names match
UPDATE 2
Ya if you wanted to add your parameters dynamically using the javascript you linked in the comments you could probably do this:
ASPX Page
<a class="open-modal" href="/MyFolder/MyView">Open Modal</a>
Javascript
$(function () {
$('body').on('click', '.open-modal', function (e) {
e.preventDefault();
var id = getParameterByName('id');
var name = 'Test';
$.post(this.href, { id: id, name: name }, function (html) {
$('<div />').kendoWindow({
visible: true,
title: 'My Modal',
modal: true,
width: '600px',
deactivate: function () {
this.element.closest('.k-widget').remove();
}
}).data('kendoWindow')
.content(html)
.center()
.open();
});
})
});
The getParameterByName
is defined in the link you posted in the comments and you controller action shouldn't need to change from the first UPDATE I posted.