1
我目前正在運行一個問題,當我去一個頁面,並點擊我的一個按鈕我得到一個頁面無法顯示錯誤消息。我意識到是因爲我有多個提交按鈕,當我點擊一個按鈕時,它不知道要點燃什麼。這裏是我目前擁有的按鈕:使用多個提交按鈕
<button class="glossyBtn" type="submit" name="submitButton" value="@Html.Encode(Kids.Resources.Message.Ok)">
<img alt="" style="vertical-align: middle; margin-right:1px" src="@Url.Content("~/Content/blueprint/plugins/buttons/icons/tick.png")" />
<span style="vertical-align: middle">Ok</span>
</button>
這是我在我的.cshtml頁:
@using (Html.BeginForm("Manage", "Invoice"))
{
<fieldset id="contentView">
<div class="row">
@Html.Raw(Html.DatePickerEnable())
<fieldset>
<span>@Kids.Resources.Entities.Billing.BillingStatus</span> @Html.EditorFor(m => m.BillingStatuses)
<br />
<div style="float:left; width:320px">
<span>Begin Date</span> @Html.EditorFor(m => m.BeginDate) @Html.ValidationMessageFor(m
=> m.BeginDate)
<span>End Date</span> @Html.EditorFor(m => m.EndDate) @Html.ValidationMessageFor(m
=> m.EndDate)
<div style="background-color: white;" class="bubble">@Html.ValidationSummary(true, Message.ValidationErrorSummary, new { @class = "error" })</div>
</div>
<button class="glossyBtn" type="submit" name="submitButton" value="@Html.Encode(Kids.Resources.Message.Ok)">
<img alt="" style="vertical-align: middle; margin-right:1px" src="@Url.Content("~/Content/blueprint/plugins/buttons/icons/tick.png")" />
<span style="vertical-align: middle">Ok</span>
</button>
</fieldset>
</div>
@if (Model.Invoices != null)
{
<div class="row">
@Html.Grid(Model.Invoices).Attributes(id => "Invoices").Columns(column =>
{
column.For(i => i.CanAddItems ? string.Format(
"<a class='noStyle' href='{0}' title='Edit'><img src='{1}'/></a>",
Url.Action("Prepare", "Invoice", new { invoiceId = i.InvoiceId }),
Url.Content("~/Content/images/pencilEdit.png")) : string.Empty).Sortable(false).Encode(false);
column.For(i => i.CanPay ? string.Format(
"<a class='noStyle' href='{0}' title='Pay'><img class='pic' src='{1}'/></a>",
Url.Action("Pay", "Invoice", new { invoiceId = i.InvoiceId }),
Url.Content("~/Content/images/moneySign.png")) : string.Empty).Sortable(false).Encode(false);
column.For(i => i.CanVoid ? string.Format(
"<a class='noStyle' href='{0}' title='Void'><img class='pic' src='{1}'/></a>",
Url.Action("Void", "Invoice", new { invoiceId = i.InvoiceId }),
Url.Content("~/Content/images/newVoid.png")) : string.Empty).Sortable(false).Encode(false);
if (Kids.Common.KidsSettings.Settings.SubmissionInvoice)
{
column.For(i => i.CanSubmit ? string.Format(
"<a class='noStyle' href='{0}' title='{2}'><img class='pic' src='{1}'/></a>",
Url.Action("Files", "PaymentVoucherFile", new { invoiceId = i.InvoiceId }),
Url.Content("~/Content/images/newVoucher.png"), Kids.Resources.Ocr.PaymentVoucherFile) : string.Empty).Sortable(false).Encode(false);
}
}).Empty(string.Format("No {0}", Kids.Resources.Entities.Billing.Invoices)).Sort(Model.GridSortOptions)
<p />
我看了整個網站,我發現好像有點太多的工作。有沒有簡單的事情,我可以在像JavaScript或類似的頁面上做,而不是更改兩個或三個文件。
Prepare - Pay - Void也是包含相同提交按鈕的結構的表單。
您需要提供更多的代碼是什麼周邊
我對C#或ASP.net瞭解不多,但通常提交按鈕會提交一個HTML'
你有多種形式,不僅有多個提交按鈕嗎? – Develoger