Solved

MVC4 Editor Template TextBoxFor Width CSS Not Working?

Posted on 2013-11-16
4
1,144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

632 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