Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1213
  • Last Modified:

MVC4 Editor Template TextBoxFor Width CSS Not Working?

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
WorknHardr
Asked:
WorknHardr
  • 2
  • 2
1 Solution
 
Bob LearnedCommented:
Is the CSS style linked properly?
0
 
WorknHardrAuthor Commented:
Do I need to place a style sheet link in the editor template?
0
 
Bob LearnedCommented:
No, the style sheet link should be in the _Layout.cshtml, which applies to all rendered pages.
0
 
WorknHardrAuthor Commented:
Thanks for helping...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now