This is a migrated thread and some comments may be shown as answers.

HOW to use PARTIAL VIEW for Content, nothing is working for me

3 Answers 233 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stacy
Top achievements
Rank 1
Stacy asked on 14 Mar 2012, 06:24 PM
I have tried all variations I have found in the forums and anything else I could find online on how to get a partial view to display in a tab on the telerik tablstrip. My partial view renders fine, but I cannot get the tabstrip to render it, I continue to get compile errors.
Currently I have the below in my view, you can see that I am trying to get the _SegmentEdit partial view to display in the tabstrip, below the tabstrip I am rendering the same view, when I comment out the tabstrip entirely, the view renders fine outside of the tabstrip, but all the different syntax and formats I have tried inside the tab item Content has not worked and I have yet to get the tabstrip to work with my partial view. Please Help.

   @(Html.Telerik().TabStrip()
        .Name("TabStrip")
        .Items(tabstrip =>
        {
            tabstrip.Add()
                .Text("ASP.NET MVC")
                .Content(() =>
                                    {
                                      Html.Partial("_SegmentEdit", Model);

                                    });
            tabstrip.Add()
                .Text("Silverlight");
        })
        .SelectedIndex(0)
        .Render()
    )

     <div>@Html.Partial("_SegmentEdit", Model)</div>


The current error with the above is, but I have tried Html.Partial, Html.RenderPartial and all syntax variations for the .Content I could find.
error CS1502: The best overloaded method match for &#39;System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)&#39; has some invalid arguments c:\IDMI\FileSelect\ASP_MVC3\FileSelect.Mvc\FileSelect.Web\Views\Segment\_Edit.cshtml(38,9): error CS1503: Argument 1: cannot convert from &#39;void&#39; to &#39;System.Web.WebPages.HelperResult&#39;

3 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 16 Mar 2012, 12:02 PM
Hello Stacy,

In your case you should use the overload of the Content method which accepts string and pass to it the HtmlString result of the Partial helper.
i.e.
tabstrip.Add()
    .Text("test")
    .Content(
        Html.Partial("Footer", Model).ToHtmlString()
    );


Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Ed James
Top achievements
Rank 2
answered on 17 Feb 2013, 02:32 PM
How can I do the above with javacript/jquery?

<input type="button" value="Add Tab" onclick='$("#tabstrip").data("kendoTabStrip").append( { text: "Class: System", content: "<div>@Html.Partial("_ClassView")</div>" }); resizeTabs();' />

The above doesn't work. I can use content: "<h1>Hello World</h1>", but have no idea how to render a partial.

Thanks.
0
Oana
Top achievements
Rank 1
answered on 01 Apr 2013, 08:29 AM
Hello,

I'm having problems with IE 9 rendering the content of a new item added to a TabStrip. There is no javascript or jQuery error and the breakpoint from my partial is hit. On Chrome all the html from all my tabs is shown but on IE 9 is not. I tried to add the tab as described above and no luck.
So this is not working on IE9: 
                            tabstrip.Add()
                                .Text("test new tab")
                                .Content(                    
                                
                                       Html.Partial("UserControls/PropertyDetails_SystemConfiguration_UserControl", Model).ToHtmlString()       
                            );
I also tried this version on IE 9 and the same problem:
                            tabstrip.Add()
                                .Text("test new tab")
                                .Content(() =>                    
                                { %>
                                      <% Html.RenderPartial("UserControls/PropertyDetails_SystemConfiguration_UserControl", Model); %>      
                             <% });

Can you please suggest a solution for my problem.
Thanks
Tags
TabStrip
Asked by
Stacy
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Ed James
Top achievements
Rank 2
Oana
Top achievements
Rank 1
Share this question
or