Aug 27, 2015, 12:39 PM
[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:
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
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]