私のテキストボックスのhtmlAttributeが機能しない理由を知ることができますか?私は@ Html.BeginFormを使用していて、他の部分に続く部分のハイパーリンクのみを使用しています。MVC view htmlAttribute not working
以下は私のコードです。
@using (Html.BeginForm())
{
@token
<div class="form-horizontal">
<h4>StoreDetail</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.StoreId)
<div class="form-group">
@Html.LabelFor(model => model.NoOfSeat, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.NoOfSeat, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.NoOfSeat, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.Label("Hyperlink", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBox("Hyperlink", ViewData["Hyperlink"], new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
</div>
</div>
私は
new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
を削除した場合、それが機能していないようにそれは同じビューになります。
'新しい{htmlAttributes =新しい{@class = "フォームコントロール"、@ReadOnly =} "読み取り専用"}新しい{@class = "フォームコントロール"'と 'を置き換える、@ReadOnly = "readonly"} 'とチェックしてください –
試しましたか? –
@RajshekarReddyその作業!ありがとう。 :D – Farid