[CLOSED] Using Razor Partial View on Non-Razor View

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [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
    <%@ 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]

Similar Threads

  1. how to use localization in an mvc razor view
    By Birgit in forum 2.x Help
    Replies: 1
    Last Post: Mar 21, 2013, 9:32 AM
  2. [CLOSED] MultiHeader for Razor view
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 07, 2013, 8:09 PM
  3. Replies: 4
    Last Post: Apr 09, 2012, 2:10 PM
  4. [CLOSED] Razor syntax for adding a partial view to a Panel
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 23, 2012, 9:55 AM
  5. Replies: 2
    Last Post: Jan 16, 2012, 9:53 AM

Tags for this Thread

Posting Permissions