I have a kendo template that contains a tabstrip. In this tabstrip I have item that use the kendo template syntax like so:
items.Add().Text("Block Attributes").LoadContentFrom("BlockAttributes", "Properties", new { blockRef = "#=BlockRef#" });
In this case the block ref gets output as expected. However when using the .Action()
method like so:
items.Add().Action("Details", "Properties", new { fiscalYear = Model.FiscalYear, blockRef = "#=BlockRef#" }).Text("Details");
the propertyId uses the literal string that is typed so it will try to navigate using "#=BlockRef#" as a parameter which results in an error.
Why does it work ok for the former but not the latter? How do I get this to work?
答案 0 :(得分:0)
我发现了一个解决方案,尽管可能不明智,但它可以执行以下操作:
items.Add().Text("Details").Url(Url.Action("Detail", "Properties", new { fiscalYear = Model.FiscalYear, blockRef = -1 }).ToString().Replace("-1", "#=BlockRef#"))
似乎没有办法让Kendo模板直接与Url.Action()一起使用,必须首先生成html,然后必须单独替换参数。我使用-1的原因是BlockRef期望一个int值,并且-1不可能自然出现在系统中。