1
我創建了一個「創建」視圖來創建新記錄。該視圖應該能夠上傳創建新記錄的圖片。使用圖片上傳創建視圖
我創建了一個表單提交的值,但是當我創建當前表單中的第二種形式(用自己的提交按鈕)圖片上傳第二個表格沒有提交按鈕。
也許你有一個想法?
create.cshtml
@model Portal.Models.Portal_Auftrag
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
$("#DatumErstZul").datepicker({ dateFormat: 'dd.mm.yy' });
$("#Schaden_Datum").datepicker({ dateFormat: 'dd.mm.yy' });
});
</script>
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<div id="tabs">
<ul>
<li><a href="#tabs-5">Bild Unfallschaden</a></li>
</ul>
<div id="tabs-5">
@Html.Action("WebAuftragUpload", ViewContext.RouteData.Values["Controller"].ToString(), new { id = ViewBag.AuftragGUID })
</div>
</div>
<p>
<input type="submit" name="submit_auftrag" value="Auftrag senden" />
</p>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
局部視圖:
<script type="text/javascript">
$(function() {
$("#ajaxUploadForm").ajaxForm({
iframe: true,
dataType: "json",
beforeSubmit: function() {
$("#ajaxUploadForm").block({ message: '<h1><img src="/Content/jquery/busy.gif" /> Datei wird hochgeladen...</h1>' });
},
success: function (result) {
$("#ajaxUploadForm").unblock();
$("#ajaxUploadForm").resetForm();
$.growlUI(null, result.message);
},
error: function (xhr, textStatus, errorThrown) {
$("#ajaxUploadForm").unblock();
$("#ajaxUploadForm").resetForm();
$.growlUI(null, 'Fehler beim hochladen der Datei');
}
});
});
</script>
@using (Html.BeginForm("AjaxWebUpload", ViewContext.RouteData.Values["Controller"].ToString(), FormMethod.Post, new { id = "ajaxUploadForm", enctype = "multipart/form-data" }))
{
<input type="hidden" name="id" value="@ViewBag.AuftragGUID" />
<input type="file" name="file" />
<input id="ajaxUploadButton" type="submit" name="submit_file" value="Datei hochladen" />
}
謝謝。這是問題所在。 – float 2011-01-14 09:22:22