PDA

View Full Version : [CLOSED] Loop through Fields iside form panel



matrixwebtech
Jun 13, 2014, 9:39 PM
VIEW


@using Ext.Net.MVC
@using Ext.Net
@using ERP.Models
@{
ViewBag.Title = "Confirm MessageBox with ButtonsConfig - Ext.NET MVC Examples";
Layout = null;
var X = Html.X();
}
@X.ResourceManager()


@(X.FormPanel()
.ID("f")
.BodyPadding(5)
.Border(false)
.Items(


X.TextField()
.ID("txtMaterialGroupName")
.FieldLabel("Material Group Name")
.AnchorHorizontal("100%")
.EmptyText("Material Group Name")
.AllowBlank(false)
,
X.TextField()
.ID("txtDescription")
.FieldLabel("Description")
.AnchorHorizontal("100%")
.EmptyText("Description")
.AllowBlank(false),
X.Hidden().ID("hdfTaskID").Value(0),
X.Button()
.Text("Save")
.ID("btnSave")
.DirectEvents(de =>
{

de.Click.Action = "save";
de.Click.EventMask.ShowMask = true;
de.Click.EventMask.Msg = "Saving...";
de.Click.EventMask.MinDelay = 100;
de.Click.After = "App.GridPanel1.getStore().reload();";

})
)

)

CONTROLLER


public void save()
{
var f = X.GetCmp<Container>("f");

foreach (Ext.Net.Field c in f.Items)
{

}
}

I am trying to get all fields from the formpanel but always Items count 0,How do I do this?

geoffrey.mcgill
Jun 14, 2014, 4:43 AM
How do I do this?

I don't think it's possible. If you're using MVC, then there is no concept of Controls or widgets on the server-side. You need to either pass in the values that you need, or acquire the values from the form submit.