views:

31

answers:

1

I'm creating a tabcontainer that shows information from partials. The code that i've created is as follows:

//Entering extension method, m_helper is of type HtmlHelper
foreach (var tab in m_tabList)
{
    sb.AppendLine("<div class='tabContent'>"); 
    m_helper.RenderPartial(tab.PartialName);
    sb.AppendLine("</div>");    
}
//Returning sb.ToString to the caller method

This will not work because the renderpartial writes directly to the output stream. I cannot render the partial to a string either. to add it to the stringbuilder object.

Any suggestions?

+4  A: 

use

m_helper.Partial(tab.PartialName);

This will return MvcHtmlString.

Amitabh