Reputation: 27955
In Visual Studio Express For Web 2012 if razor view is formatted, formatter adds extra spaces to end of javascript string. This causes invalid data to be passed.
Before formatting:
@if (!(Model.Entity is Palk) && Model.Entity.CanInsert && !Model.IsNew())
{
<input type="button" id="add_grid_top" class='button' value='@I("Lisa")'
title='@(I("Lisa dokument") + " (Ctrl+N)")'
onclick="javascript:replaceTab( 'Detail?' +$.param({ _entity:'@Model.FormName',
_vmnr: @Model.Vmnr }))" />
}
After pressing Ctrl+K D :
@if (!(Model.Entity is Palk) && Model.Entity.CanInsert && !Model.IsNew())
{
<input type="button" id="add_grid_top" class='button' value='@I("Lisa")'
title='@(I("Lisa dokument") + " (Ctrl+N)")'
onclick="javascript:replaceTab( 'Detail?' +$.param({ _entity:'@Model.FormName ',
_vmnr: @Model.Vmnr }))" />
}
Note that string
'@Model.FormName'
is formatted to
'@Model.FormName '
This causes invalid data to be passed to controller. How to disable such formatting ?
ASP.NET MVC3, C#, jquery and Microsoft Visual Studio Express For Web 2012 are used.
Update
I tried
Tools / Options / Text Editor / HTML / Tabs settings but problem persist.
In Tab window Indenting does not change behaviour. If Keep tabs is selected, two tabs are inserted after FormName. If Insert spaces is selected, 8 spaces are inserted to after FormName.
I unchecked also some options in formatting tab but this does not cause any changes. How to fix this ?
Upvotes: 2
Views: 438
Reputation: 34852
Go into options and change tab to equal 4 spaces. I believe the tab character is your issue.
Upvotes: -2