在HTML.TextBoxFor中右对齐文本

7
我正在使用ASP.Net MVC和Twitter Bootstrap,如何将TextBoxFor中的文本右对齐?
@Html.TextBoxFor(model => model.PaymentReceived, 
new { @class = "pmtallocated pull-right" , .dir = "rtl" })

我在尝试以上操作时收到错误信息Invalid expression term '.'

谢谢,

Mark


你的 pmtallocated pull-right CSS 类有 direction:RTL; 属性吗?如果是这样,你就不需要在 Razor 代码中使用 .dir = "rtl" 代码。 - user1477388
嗨,谢谢,但我所需要做的就是使用@而不是.dir! - Mark
2个回答

9

尝试

new { @class = "pmtallocated pull-right" , @dir = "rtl" })

7

尝试任何一个

@Html.TextBoxFor(model => model.PaymentReceived, 
new { @class = "pmtallocated pull-right" , @dir = "rtl" })

或者

@Html.TextBoxFor(model => model.PaymentReceived, 
new { @class = "pmtallocated pull-right" , @style="text-align:right"})

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接