Nov 18, 2013, 8:10 PM
[CLOSED] Using Razor Partial View on Non-Razor View
I am wanting to add some new features to a Non-Razor ASPX page and was wanting to implement it by using a razor partial view (.cshtml). However, whatever combinations I try, the layout is not right.
In the following example, I want the contents of the partial view to display in the middle panel but it ends up displaying at the top of the page outside of the main page. It is 'somewhat' understandable as the content of the razor view is not in the Items collection of the Panel I want to put them in. Either way, I am wondering if their is a solution or if I was crazy to start with.
ASPX page
In the following example, I want the contents of the partial view to display in the middle panel but it ends up displaying at the top of the page outside of the main page. It is 'somewhat' understandable as the content of the razor view is not in the Items collection of the Panel I want to put them in. Either way, I am wondering if their is a solution or if I was crazy to start with.
ASPX page
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<head runat="server">
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Panel ID="ViewPort1" runat="server" Layout="VBoxLayout" Height="300" >
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch"></ext:VBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:Panel runat="server" Title="North" Flex="1">
</ext:Panel>
<ext:Panel runat="server" Title="Center" Flex="1" Layout="FitLayout" >
<Items>
<ext:Container>
<Content>
<% Html.RenderPartial("~/Views/Test/TestPartial.cshtml"); %>
</Content>
</ext:Container>
</Items>
</ext:Panel>
<ext:Panel runat="server" Title="South" Flex="1">
</ext:Panel>
</Items>
</ext:Panel>
</form>
</body>
</html>
TestPartial.cshtml@(
Html.X().Panel().Height(300).Title("TOP PANEL in Partial View")
.Layout(LayoutType.VBox)
.LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.Stretch })
.Items(
Html.X().Panel().Flex(1).Title("FIRST PANEL"),
Html.X().Panel().Flex(1).Title("SECOND PANEL")
)
)
Thank you for your help.
Last edited by Daniil; Nov 22, 2013 at 4:12 AM.
Reason: [CLOSED]