Frage

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?

War es hilfreich?

Lösung

Use this to change initial value:

@Html.TextBoxFor(m => names, new { Value = "" })
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top