This question is locked. New answers and comments are not allowed.
So
I've used the tab strip previously in the following way:
And that worked great, but now I'm using an MEF project, where child projects are loading it via an MEF framework. This all works fine displaying the first tab, as a boot strap. and even the other tabs dynamically.
But the problem is, the tabs aren't hooked up to an action or controller this way. So we change
TO
This is great, our action is called. But, the problem is, this action is of return type void. because we don't want to redirect to the view, this would prove the tab strip useless.
But when
I've used the tab strip previously in the following way:
@{ Html.Telerik().TabStrip() .Name("TabStrip") .Items(tabstrip => { tabstrip.Add() .Text("1") .ImageUrl("~/Content/Images/1.png") .Content(() => { @Html.RenderPartial("1/2"); });And that worked great, but now I'm using an MEF project, where child projects are loading it via an MEF framework. This all works fine displaying the first tab, as a boot strap. and even the other tabs dynamically.
But the problem is, the tabs aren't hooked up to an action or controller this way. So we change
@using Framework.Web;@using Telerik.Web.Mvc;@{ Html.Telerik().TabStrip() .Name("TabStrip") .BindTo(MEFControllerFactory.GetTabVerbsForCategory("1"), (tab, verb) => { tab.Text = verb.Name; tab.ImageUrl = verb.Image; if (verb.Name != "1") tab.Content = () => Html.RenderPartial(verb.View, new ViewDataDictionary()); } else { tab.Content = () => Html.RenderPartial(verb.View); } }) .SelectedIndex(1) .Render(); }TO
@using Framework.Web;@using Telerik.Web.Mvc;@{ Html.Telerik().TabStrip() .Name("TabStrip") .BindTo(MEFControllerFactory.GetTabVerbsForCategory("1"), (tab, verb) => { tab.Text = verb.Name; tab.ImageUrl = verb.Image; if (verb.Name != "1") { tab.ActionName = verb.Action; tab.ControllerName = verb.Controller; tab.Content = () => Html.RenderPartial(verb.View, new ViewDataDictionary()); @* tab.ContentUrl = Url.Action(verb.Action, verb.Controller, verb.View); *@ } else { tab.Content = () => Html.RenderPartial(verb.View); } }) .SelectedIndex(1) .Render(); }This is great, our action is called. But, the problem is, this action is of return type void. because we don't want to redirect to the view, this would prove the tab strip useless.
But when
tab.ActionName = verb.Action;
tab.ControllerName = verb.Controller;
are added, that's what it does. It no longer renders the content in the tab, rather it attempts to redirect to that view. Doesn't throw a 404, it finds the view but no data, and it's totally outside of the app now.
I tried Partial, with and without .ToHtmlString(), to no success. Using Partial, it does indeed render within the tab strip but not to the correct destination. Changing the value of verb.View has no effect. It either throws an error that the view could not be found or a host of other issues.
So in short, the question is. How do I implement the above?
PS. ContentUrl(verb.Action, verb.Controller) doesn't work either ;)
Thanks!