1

After migrating from mvc 3 to mvc 4 Razor v.2 wrong parse my js template.

Problem in the next {{if}} section

        {{? (it.@Model.GetPropName(x => x.Children)).length < it.@Model.GetPropName(x => x.ChildTaskTotalCount)}}
        {{?}}

Razor v2 parse second argument of condition(it.@Model.GetPropName(x => x.ChildTaskTotalCount) ) as a string. And dot.js throws error on client browser.

@Model.GetPropName()- function which returns name of model property.Other words it.@Model.GetPropName(x => x.ChildTaskTotalCount) equal to it.ChildTaskTotalCount, but (it.Children).length

This code block works correctly in asp.net mvc 3 with razor v.1.

How should i change syntax to correct work with razor v.2?

JstnPwll
  • 8,585
  • 2
  • 33
  • 56

0 Answers0