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

[Solved] Partial view inside of tab

3 Answers 243 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.
TestSubject8
Top achievements
Rank 1
TestSubject8 asked on 29 Apr 2011, 09:45 PM
I'm trying to get a partial view inside of a tab and I am having some difficulty with the syntax I've tried a number of different ways here is my last attempt(vbhtml) I found from another forum post although that one was in cshtml:

Html.Telerik().TabStrip() _
        .Name("TabStrip") _
        .Items(Function(tabStrip) _
                   tabStrip.Add() _
                    .Text("Contacts") _
                    .Content(@<text>@Html.RenderPartial("~/Views/Home/Index.vbhtml")</text>) _
                .SelectedIndex(0) _
                .Render()

Any advice would be very much appreciated.

3 Answers, 1 is accepted

Sort by
0
Damien
Top achievements
Rank 1
answered on 06 May 2011, 10:52 AM
Try

 .Content(@Html.Partial("[PartialViewName]").ToHtmlString())
0
TestSubject8
Top achievements
Rank 1
answered on 06 May 2011, 04:23 PM
just needed to remove the @ in front of html.partial and was good to go!  Thank you for you help!
0
Dhawal
Top achievements
Rank 1
answered on 22 Jun 2011, 03:34 AM
I'm running into issues when the PartialView has javascript. Any text in the partial view is display, but the script on the partial view is not getting executed.

This is how i load my tab:

tabstrip.Add()

.Text(

 

"Reports Tab")

 

.LoadContentFrom(

 

"AjaxView_LoadReport", "Reports");


On the server-side, I have the following code:

 

public

 

 

ActionResult AjaxView_LoadReport()

 

{

 

 

return PartialView("Partials/Report", myModel);

 

}


The partial view looks as follows:

 

<%

 

@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>

 

 

 

<p>Hello World</p>

 

<

 

 

div id="chart" style="width:100%;height:100%"></div>

 

<

 

 

script type="text/javascript" src="https://www.google.com/jsapi"></script>

 

<

 

 

script type="text/javascript">

 

 

 

 

google.load("visualization", "1", { packages: ["corechart"] });

 

google.setOnLoadCallback(drawChart);

 

 

function drawChart() {

 

 

 

var data = new google.visualization.DataTable();

 

data.addColumn(

 

'string', 'Category');

 

data.addColumn(

 

'number', 'Count');
data.addRow(['Row1', 100]);
data.addRow(['Row2', 200]);

 

 

 

var chart = new google.visualization.PieChart(document.getElementById('chart'));

 

chart.draw(data, { width: 450, height: 300, title:

 

'Demo Chart', backgroundColor: '#4F4F4F',

 

colors: [

 

'#b99c56', '#75a4b1', '#887766'], titleTextStyle: { color: '#A6C633' },

 

legendTextStyle: { color:

 

'white' }

 

});

}

 

 

</

 

 

script>


The 'Hello World' text is displayed but the google chart is not displayed.

 

Tags
TabStrip
Asked by
TestSubject8
Top achievements
Rank 1
Answers by
Damien
Top achievements
Rank 1
TestSubject8
Top achievements
Rank 1
Dhawal
Top achievements
Rank 1
Share this question
or