Kayvan Salimi
Kayvan Salimi

Reputation: 335

Using Html.TextBox with custom property in mvc5

if we have the below code,

<input id="Name" name="Name" type="text" data-bind="value: Name" class="title width-7" />

we can translate it using @Html.TextBoxFor to:

@Html.TextBoxFor(m => m.Name, new { data_bind="value: Name", @class = "title width-7" })

now I have this line that i can't translate the 'placeholder' attribute with @Html.TextBoxFor, how can I do that??

 <input type="email" class="form-control" id="exampleInputEmail3" placeholder="Enter email">

thanks...

Upvotes: 2

Views: 890

Answers (1)

Anaiah
Anaiah

Reputation: 633

Yeah to make it clear to anyone :

@Html.TextBoxFor(m => m.Name, new { data_bind="value: Name", @class = "title width-7" , @placeholder ="Placeholder Here"})

Thanks. Hope it helps.

Upvotes: 1

Related Questions