5
votes

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

2
It looks like a bug in VS, it thinks your Razor syntax is part of the HTML rather than distinct. I suggest filing this on MS Connect: connect.microsoft.comDai
Thanks. Perhaps the problem is related to the convoluted javascript? Checkout my edits.ATL_DEV
Please also post the rendered HTML as well.Dai
What is the error message you're getting? Post it to your question.Dai
I've seen this with various pieces of JavaScript. My recommendation is first, Separate JS and markup. (Bind in a document ready even and stop using on* attributes). If that's not practical, try storing your JS in a variable beforehand so it's simply onclick="@myvar".Brad Christie

2 Answers

1
votes

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'.

0
votes

Try this

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