0

I'm working on an MVC application.

I have the following line of code:

@Lines.Html.TextBox(p => p.Dscription)

How can apply my own style to this text box? i.e. change the width?

3 Answers 3

1

You can just append a generic object as the second parameter which contains the appropriate attributes ::

@Lines.Html.TextBox(p => p.Description, new { @class = "className", @style = "width: 200px" }
Sign up to request clarification or add additional context in comments.

Comments

0

add another param to the helper:

@Lines.Html.TextBox(p => p.Dscription, new {@class="clasecss", more properties})

Regards,

Comments

0

There is an overload of (Textbox) html helper:

@Lines.Html.TextBox(p => p.Dscription, null, new { @class = "css-class" })

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.