May 09, 2012, 1:11 PM
[CLOSED] [RAZOR] Iterate over controls in FormPanel
Hi
I've defined the FormPanel outlined below. Within my controller given the reference to the FormPanel I want to iterate over the controls defined with the form.
I've tried the .Items, .Controls properties of the FormPanel but these properties don't seem to be initialised.
CSHTML Code:
I've defined the FormPanel outlined below. Within my controller given the reference to the FormPanel I want to iterate over the controls defined with the form.
I've tried the .Items, .Controls properties of the FormPanel but these properties don't seem to be initialised.
CSHTML Code:
Html.X().FormPanel()
.ID("formPanel")
.Title("formPanel")
.Collapsible(true)
.ButtonAlign(Alignment.Right)
.Layout(LayoutType.HBox)
.Items(items =>
{
items.Add(Html.X().Panel()
.ID("Panel1")
.Title("Panel1")
.Closable(true)
.CloseAction(CloseAction.Hide)
.Add(Html.X().DateField()
...
);
items.Add(Html.X().Panel()
.ID("Panel2")
.Title("Panel2")
.Closable(true)
.CloseAction(CloseAction.Hide)
.Add(Html.X().ComboBox()
...
);
...
Controller Code: public ActionResult OnDirectClick()
{
var formControls = X.GetCmp<FormPanel>("formPanel").Items;
foreach(AbstractComponent control in formControls )
{
// Do operation
}
...
}
Last edited by Daniil; May 11, 2012 at 4:30 PM.
Reason: [CLOSED]