Solved

MVC4 Editor Template TextBoxFor Width CSS Not Working?

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now