Solved

MVC4 Editor Template TextBoxFor Width CSS Not Working?

Posted on 2013-11-16
4
1,120 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Checking a checkbox based on SQL DataReader boolean value in ASP.NET(VB) 2 45
Add a Condition in ASP Repeater 6 44
ASP.NET MVC - Views 3 38
using CK editor in iframes 5 26
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 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