[CLOSED] render partial view

  1. #1

    [CLOSED] render partial view

    Hi,

    I have a main screen let's say Main.cshtml, where in I have one of the panel whose items is a partial view (AddItems.cshtml), and AddItems.cshtml has one button and upon clicking that button it opens another partial view(ThirdPartial.cshtml) which is in shared folder and I am registering this last partial view from my main layout(_layout.cshtml).


    Main.cshtml:
    @section sectionBottom{
        @(
            X.Panel()
            .Layout(LayoutType.HBox)
            .LayoutConfig(new HBoxLayoutConfig { Align = HBoxAlign.Stretch})
            .Flex(1)
            .Items
                (
                
                X.Panel().ID("pnlMain").Cls("MainStyle").Layout(LayoutType.Fit).ItemsFromPartial("AddItems").Flex(1)
                )
        )
    AddItems.cshtml:

    @{
        var X = Html.X();
    }
    <script src="~/Scripts/Main/addItems.js"></script>
    
    @(
    
    X.FormPanel()
        .Layout(LayoutType.VBox)
        .LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.Stretch, Pack = BoxPack.Start })
        .PaddingSpec("20 0 0 0")
        .Flex(1)
        .Items(
            X.FieldContainer().LabelSeparator("").LabelAlign(LabelAlign.Left).FieldLabel(" ").LabelStyle("Font-weight:bold").Layout(LayoutType.HBox).MarginSpec("20 0 0 0")
            .LayoutConfig(new HBoxLayoutConfig { Pack = BoxPack.End })
            .Items(
                X.Button().Text("AddItems")
                .Listeners(li => { li.Click.Handler = "App.ThirdPartial.show();"; })
                 .Flex(1).MaxWidth(150)
                    
                )
            )
        )
    )
    _layout.cshtml
    @HTML.Partial("ThirdPartial")
    @HTML.Partial("FourthPartial")
    thirdPartial.cshtml:

    @{
        Layout = null;
        var X = Html.X();
    }
    
    
    <script src="~/Scripts/Third/third.js"></script>
    @(X.Window().ID("ThirdPartial").Layout(LayoutType.Fit).MarginSpec("50 0 0 0").Height(600).Width(800).Modal(true).Hidden(true)
        .Items
        (
    
            X.Panel().Layout(LayoutType.VBox).LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.Stretch })
        .Items
        (
            X.FormPanel().Layout(LayoutType.HBox).Border(false).MinWidth(640).BodyBorder(0).BodyStyle("padding:5px 5px 5px;").Flex(1)
            .Items
            (
                X.Panel().Flex(1).Layout(LayoutType.Anchor).Border(false).BodyBorder(0)
                .Items
                (
                           X.RadioGroup()
                                .ID("RadioGroup1")
                                .FieldLabel("Select Item: ")
                                .ColumnsNumber(4)
                                .AutomaticGrouping(false)
                                .Items(
                                    X.Radio().Name("employee").ID("rdName").InputValue("0").BoxLabel("Name").Checked(true),
                                    X.Radio().Name("employee").ID("rdLocation").InputValue("1").BoxLabel("Location"),
                                    X.Radio().Name("employee").ID("rdDepartment").InputValue("2").BoxLabel("Department"),
                                    X.Radio().Name("employee").ID("rdGroup").InputValue("3").BoxLabel("Group")
                                )
                               
                            X.Container().ID("Container1").Flex(1).Layout(LayoutType.Anchor).Border(false).MinHeight(150)
                            .Items
                            (
                                X.Panel().Flex(1).Layout(LayoutType.Anchor).Border(false).BodyBorder(0).Hidden(false)
                                .Items
                                (
                                    X.FieldContainer().LabelSeparator("").LabelAlign(LabelAlign.Left).Flex(1).FieldLabel("Search by employee Name:").LabelStyle("Font-weight:bold").Layout(LayoutType.HBox)
                                    .Items
                                    (
                                        X.FormPanel().ID("txtUsers").MinHeight(50).Flex(1).MarginSpec("0 10 0 10").Border(true).AutoScroll(true).MaxHeight(100),
                                        X.Button().ID("btnUser").ToolTip("Add User").IconCls("add_user_icon")
                                        .Listeners(l => { l.Click.Handler = "ldapParent='Users'; App.FourthPartial.show();"; })
                                    )
                                )
                                
                            )
    
                )
    
            )
              )
        ))

    this all works fine, now, the "ThirdPartial" partial view supposed to have a icon button which opens another partial view(say "FourthPartial.cshtml"). how to achieve that??? My app gives exception on fourth partial view page when I click the icon on the third partial view.

    This "FourthPartial" is also in the Shared folder and I am registering that also in base layout(_layout.cshtml) as in the above code.

    Please help.

    Thanks
    Last edited by Daniil; Sep 04, 2015 at 5:10 PM. Reason: [CLOSED]
  2. #2
    Hi @sharmav1,

    My app gives exception on fourth partial view page when I click the icon on the third partial view.
    Please provide a test project to reproduce it. Please see 7.C) for details and requirements on a test project.
    Forum Guidelines For Posting New Topics

Similar Threads

  1. Render partial view with parameter
    By czuroski in forum 2.x Help
    Replies: 1
    Last Post: May 12, 2014, 6:43 PM
  2. Replies: 2
    Last Post: Feb 06, 2014, 1:19 PM
  3. [CLOSED] Render Partial to Fit in Viewport
    By RCM in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 01, 2013, 10:45 AM
  4. [CLOSED] Render Partial View on request failure
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Apr 01, 2011, 1:51 PM
  5. Problem in Partial Render of an ascx in MVC
    By aliassaf in forum 1.x Help
    Replies: 0
    Last Post: Nov 05, 2009, 5:22 AM

Posting Permissions