简体   繁体   English

Kendo TabStrip:将动作渲染到 MVC 4 中的选项卡

[英]Kendo TabStrip: Rendering Action into tab in MVC 4

I've been trying to render and Action @Html.RenderAction(...) into the .Text() of a Kendo Tab Strip with out success.我一直在尝试将@Html.RenderAction(...)渲染和 Action @Html.RenderAction(...)渲染到 Kendo Tab Strip 的.Text()中,但没有成功。

Is there a way to render a full action into a tab?有没有办法将完整的动作渲染到选项卡中?

I found it:我找到了:

@(Html.Kendo().TabStrip()
  .Name("tabMain")
  .Items(items =>
      {
          items.Add()
               .Text("My Tab Title")
               .Content(Html.Action("Index","MyChildController").ToString());
      })
  )

Trick is to call .ToString on the Html.Action call.技巧是在Html.Action调用上调用.ToString

I think you can also use LoadContentFrom :我想你也可以使用LoadContentFrom

@(Html.Kendo().TabStrip()
    .Name("tabMain")
    .Items(items => {
        items.Add()
            .Text("My Tab Title")
            .LoadContentFrom("Index","MyChildController"));
  })

) )

Other way of doing it, and in this case using Html.RenderAction is:其他方法,在这种情况下使用 Html.RenderAction 是:

@(Html.Kendo().TabStrip()
  .Name("tabMain")
  .Items(items =>
      {
          items.Add()
               .Text("My Tab Title")
               .Content(@<text> @{Html.RenderAction("Action", "Controller", new (or nothing) {data ="" });} </text>);
      })
  )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM