Question

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?

Was it helpful?

Solution

Use this to change initial value:

@Html.TextBoxFor(m => names, new { Value = "" })
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top