Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Right align text in an HTML.TextBoxFor

I'm using Twitter Bootstrap, with ASP.Net MVC.

How can I right-align the text in the TextBoxFor:

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

I get the error Invalid expression term '.' when trying above.

Thank you,

Mark

like image 695
Mark Avatar asked Sep 25 '13 13:09

Mark


People also ask

How do I align text right in a text box?

Right-click the text box for which you want to set vertical alignment. On the shortcut menu, click Format Text Box. In the Format Text Box dialog box, click the Text Box tab. In the Vertical alignment box, select Top, Middle, or Bottom.

How do I move text to the right?

Align the text left or right Select the text that you want to align. On the Home tab, in the Paragraph group, click Align Left or Align Right .

How do you justify a text box in HTML?

Apply style="text-align: right" to the input tag. This will allow entry to be right-justified, and (at least in Firefox 3, IE 7 and Safari) will even appear to flow from the right.


2 Answers

Try any

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

or

@Html.TextBoxFor(model => model.PaymentReceived, 
new { @class = "pmtallocated pull-right" , @style="text-align:right"})
like image 33
Murali Murugesan Avatar answered Sep 18 '22 23:09

Murali Murugesan


try

new { @class = "pmtallocated pull-right" , @dir = "rtl" })
like image 99
Microsoft DN Avatar answered Sep 20 '22 23:09

Microsoft DN