I am trying to open a jquery dialog. What happens is that I see the following html text and form visualization when I try to open PartialView:
<form action="/Plt/FileUpload" method="post"><input data-val="true" data-val-number="The field PlNum must be a number." data-val-required="The PlNum field is required." id="PlNum" name="PlNum" type="hidden" value="36028" /> <div id="errMsg" > </div> <p>File upload for Pl# 36028</p> <input type="file" name="file" /> <input type="submit" value="OK" /> </form>
Here is the controller action:
public ActionResult FileUpload(int id) { var model = new FileUpload { PlNum = id }; return PartialView(model); }
This is what the view for PartialView looks like:
@model Ph.Domain.Lb.Models.FileUpload <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
@using (Html.BeginForm("FileUpload", "Plts", FormMethod.Post, null)) { @Html.HiddenFor(a => a.PlNum) <div id="errMsg" > @if (TempData["ErrMessage"] != null) { @TempData["ErrMessage"] } </div> <p>File upload for Pl# @Model.PlNum</p> <input type="file" name="file" /> <input type="submit" value="OK" /> }
Here is what my ajax call looks like:
var url = '@Url.Action("FileUpload", "Plt")' + '?id=' + encodeURIComponent(rowid); $.ajax({ url: url, type: 'GET', success: function(result) { if (result.success) { $('#dialog').dialog('close'); } else {
To repeat, the ajax call will actually reach the ActionResult, but not sure when it is trying to show a partial view that shows HTML and rendered html.
source share