Jul 09, 2013, 5:36 PM
[CLOSED] Loading Partial View within a Portlet
I'm having trouble loading a partial view inside of a portlet. With the code below, only the ext.net button control loads inside the portlet, all other html within the partial view is displayed outside of the porlets.
Am I missing an ext.net container of some kind to load the partial view in?
Please don't link me to the examples, I've looked there already.
Thank you,
Rob
--
Main View
Am I missing an ext.net container of some kind to load the partial view in?
Please don't link me to the examples, I've looked there already.
Thank you,
Rob
--
Main View
@functions
{
private Ext.Net.Portlet.Builder InitPortlet(IWidgetWrapper widgetModel)
{
var portletBuilder = new Ext.Net.Portlet.Builder();
switch (widgetModel.WidgetId)
{
case 1:
portletBuilder.ItemsFromPartial("~/Views/Shared/Widgets/_AlertsWidget.cshtml", widgetModel as AlertsWidgetViewModelDTO);
break;
default:
portletBuilder.ItemsFromPartial("~/Views/Shared/Widgets/_ErrorWidget.cshtml");
break;
}
return portletBuilder;
}
}
<div>
@(Html.X().ResourceManager(ViewBag.ManagerConfig as MvcResourceManagerConfig).RenderStyles(ResourceLocationType.None))
@(Html.X().Portal().ID("Dashboard_Portal").Border(false).Layout(Ext.Net.LayoutType.Fit)
.Items(Html.X().Portal()
.Items(Html.X().PortalColumn().Cls("x-column-padding")
.Items(portlets =>
{
foreach (var widgetModel in Model.WidgetContents)
{
IWidgetWrapper thisWidget = widgetModel;
portlets.Add(InitPortlet(widgetModel));
}
})
)))
</div>
Partial View
@model PR.DTO.AlertsWidgetViewModelDTO
<div>
<h3>Alerts Widget</h3>
<p>
This is where some alerts will go
</p>
<br />
@Html.X().Button().Icon(Icon.Application).Text("Ext.Net button - click").Handler("Ext.Msg.alert('Ext.NET button', 'Hello');")
</div>
Last edited by Daniil; Jul 23, 2013 at 12:55 PM.
Reason: [CLOSED]