I have a main view (say with one dropdown), where I bound the view with model "TabViewModel".
In the main view I have a link button, upon click of that I need to call a jquery dialog and in this dialog I need to show the same dropdown (what I select a item from DDL in main view, need to show as selected here).
To get the value of selected DDL, we do $.post in below call and call the below controller method which load the partial view in jquery dialog.
$(function () {
$.ajaxSetup({ cache: false });
// Wire up the click event of any current or future dialog links
$('.dialogLink').live('click', function () {
var dialogId = 'uniqueName-' + Math.floor(Math.random() * 1000)
var dialogDiv = "";
// Load the form into the dialog div
var data = $('form').serialize();
$.post(this.href, data)
.success(function (result) {
alert(result);
$(dialogDiv).html(result); })
$(dialogDiv).dialog({
/options/});
return false;
});
});
public ActionResult OpenReportDialog(TabViewModel model)
{ return PartialView(model); }
Everything perfect, but jquery dialog load with nothing, however we got correct html (alert(result);).
below is the partial view (OpenReportDialog.cshtml) @model TabViewModel
@Model.FirstName (example)
Please let me know what wrong with jquery code, why Html is not rendered with dialog. Thanks!