2

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...

2
  • It should work... Can you show the helper method you tried? Commented Jun 8, 2015 at 8:19
  • I solved it by this code : @Html.TextBoxFor(model=>model.name, new{@placeholder="",@class=""}) Commented Aug 1, 2015 at 6:26

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.