Upgrade from .net 4 to 4.5 breaks Html.Raw call in Javascript

前端 未结 4 2025
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 06:53

I have the following code in a c# MVC 3 razor page where I am passing serialized data into a javascript variable for KnockoutJs:

    @{   
        var listDa         


        
4条回答
  •  鱼传尺愫
    2021-01-06 07:33

    This issue still exist in Visual Studio 2013 SP 2

    To fix this warning message initialize javascript variable first. IMO Visual studio think var as implicitly typed if any var followed by @.

            var ListData;
            var PagerData;
            ListData =  @(Html.Raw(listData));
            PagerData =  @(Html.Raw(pagerData));
    

提交回复
热议问题