Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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?
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" }
Add a comment
add another param to the helper:
@Lines.Html.TextBox(p => p.Dscription, new {@class="clasecss", more properties})
Regards,
There is an overload of (Textbox) html helper:
@Lines.Html.TextBox(p => p.Dscription, null, new { @class = "css-class" })
Required, but never shown
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.
Explore related questions
See similar questions with these tags.