質問

In my partial view I have passed some list of strings from a method in controller Here is my partial view

@model IEnumerable<string>

@foreach(var names in Model)
{
    
    <div class="input-block-level">@Html.TextBoxFor(m=>names)</div>
    <br/>
}

Here is how it looks in browser

enter image description here

Why am I getting the texts in textbox? I mean I would want them there but as placeholder not default text. How can I not have those values and just have a plane textbox?

役に立ちましたか?

解決

Use this to change initial value:

@Html.TextBoxFor(m => names, new { Value = "" })
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top