ATL_DEV
ATL_DEV

Reputation: 9591

Visual Studio 2013 Format Document converts attributes to lowercase in MVC

For some odd reason, Visual Studio 2013 keeps converting the following line of code:

<input type="button" value="@T("Checkout.ShipToThisAddress")" class="button-1 select-shipping-address-button" onclick=" setLocation('@Url.RouteUrl("CheckoutSelectShippingAddress", new {addressid = item.Id})') " />

To this:

<input type="button" value="@T("Checkout.ShipToThisAddress")" class="btn-default-1 pull-right" onclick=" setlocation('@url.routeurl("checkoutselectshippingaddress", new { addressid = item.id })') " />

Note that tag attribute names as well as content are lower case. Also, Visual Studio complains that the line is missing a double-quote only in the editor. Here's the generated output:

<input type="button" value="Bill to this address" class="btn-default-1 pull-right" onclick="setLocation(' /checkout/selectbillingaddress?addressid=10856 ') ">

I tried to use the following suggestions, but it applies only to ASP not MVC pages. I couldn't find an MVC option in the Text Editor options in VS 2013.

Format Document in Visual Studio 2010 asp tags format to lowercase

Upvotes: 5

Views: 494

Answers (2)

Bonneville
Bonneville

Reputation: 3583

There is a setting in Tools > Options > Text Editor.

Within the HTML (Web Forms) section, select 'Formatting' and you can set 'Capitalization' for various items including 'Client attributes'

It appears to default to 'Lowercase' but you can change it to 'As entered'.

Upvotes: 1

Michael Samteladze
Michael Samteladze

Reputation: 1330

Try this

value= "@Html.Raw(Checkout.ShipToThisAddress)"

Upvotes: 0

Related Questions