There are several ways to load a partial view in the jquery dialog. It uses the safest approach, namely loading a partial view when the page loads. Something like that:
<div id="mydialog"> @Html.Partial("MyAction", "MyController") </div>
and then using jquery I convert this div block to a jquery dialog.
<script type="text/javascript"> $(document).ready(function () { $("#mydialog").dialog(); }); </script>
Why I find it safe, because all kinds of validation work very well, and code reuse is applied. However, you can dynamically load a partial view into a dialog, as suggested by jimmym. You have to be careful with the two pitfalls here.
Jquery unobtrusive should parse the newly loaded form. You can do something like this.
$. Validator.unobtrusive.parse ($ ('# MyForm'))
Make sure that you do not upload nested forms.
amarnath chatterjee May 26 '12 at 4:23 a.m. 2012-05-26 04:23
source share