Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MVC4 Editor Template TextBoxFor Width CSS Not Working?

Posted on 2013-11-16
4
Medium Priority
?
1,166 Views
Last Modified: 2013-11-21
I'm now using TextBoxFor instead of EditorFor so I can at least simplify the CSS.
I really want to set the CSS in the style sheet.
I'm beginning to wonder if Editor Templates are still a bit buggy...

This works locally!
   @Html.TextBoxFor(x => x.Amount, new { style="width:75px" })

This does NOT work using style sheet!
  @Html.TextBoxFor(x => x.Amount, null, "Amount" )
  @Html.TextBoxFor(x => x.Amount, new { @class = "amount" })

[Style Sheet]
 #Amount
    {
        width: 75px
    }

    .amount
    {
        width: 75px
    }
0
Comment
Question by:WorknHardr
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39654418
Is the CSS style linked properly?
0
 

Author Comment

by:WorknHardr
ID: 39654594
Do I need to place a style sheet link in the editor template?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1600 total points
ID: 39654772
No, the style sheet link should be in the _Layout.cshtml, which applies to all rendered pages.
0
 

Author Closing Comment

by:WorknHardr
ID: 39667092
Thanks for helping...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question