|
-
Jun 10th, 2011, 05:44 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] MetaData Formatting MVC 3
Hi All,
I'm using POCO entities and am using MetaData to help with the UI.
This works ok, but seems to default the display. e.g.
Code:
[DisplayName("")]
[UIHint("NotEnabledForDecimal")]
public object TechnicalPriceRo { get; set; }
This gives me a an uneditable textbox with the value of the object (Good).
However, I want to reduce the width of the textbox and the contents are left aligned when I want them right aligned. Does anybody have any idea what I need to attach to my MetaData to make these 2 things happen?
Thanks
-
Jun 10th, 2011, 08:13 AM
#2
Thread Starter
Fanatic Member
Re: MetaData Formatting MVC 3
Update...Still not working, but in my NotEnabledForDecimal Helper, I thought the size property would do the trick regarding size of the box, but it's made no difference:
Code:
@model Decimal
@Html.TextBox("", Model.ToString(), new { disabled = "disabled", size = 4 })
To align the text to the right, I thought I'd be able to use the inline-styling:
Code:
<div style="width:10em; clear:both; left:308px; position:relative; text-align:right;">
@Html.EditorFor(model => model.TechnicalPriceRo)
</div>
that too doesn't work
-
Jun 10th, 2011, 08:34 AM
#3
Thread Starter
Fanatic Member
Re: MetaData Formatting MVC 3
Ok, just for completeness, Here is the answer:
the style needs to be set against the helper, then it all works:
Code:
@model Decimal
@Html.TextBox("", Model.ToString(), new { disabled = "disabled", style="width:5em; text-align:right" })
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|