Sep 01, 2016, 7:27 AM
[CLOSED] Model binding to store
Hi,
I have the next test case:
Model:
Controller:
View:
What I'm doing wrong?
Thanks!
I have the next test case:
Model:
public class Test
{
public One TEST_ONE { get; set; }
public Two TEST_TWO { get; set; }
public Test()
{
this.TEST_ONE = new One { ONE = "1" };
this.TEST_TWO = new Two { TWO = "2" };
}
}
public class One
{
public string ONE { get; set; }
}
public class Two
{
public string TWO { get; set; }
}
Controller:
public ActionResult Test()
{
Models.Test model = new Models.Test();
return View(model);
}
View:
@model Models.Test
@using Ext.Net;
@using Ext.Net.MVC;
@{
Layout = null;
var X = Html.X();
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
Ext.onReady(function () {
Ext.getCmp('viewport_layout').updateLayout();
});
</script>
</head>
<body>
@(Html.X().ResourceManager().ShowWarningOnAjaxFailure(false))
@using (Html.BeginForm())
{
var dataView = X.DataView()
.ID("dvTEST")
.Store(
Html.X().StoreFor(Model).ID("stTEST")
)
.MultiSelect(true)
.OverItemCls("x-item-over")
.ItemSelector("div.thumb-wrap")
.EmptyText("No data")
.TrackOver(true)
.Tpl(
Html.X().XTemplate().Html(@"TEMPLATE")
);
var textField = X.TextFieldFor(m => m.TEST_ONE.ONE);
@(X.Viewport()
.ID("viewport_layout")
.Layout(LayoutType.Fit)
.Items(dataView)
)
}
</body>
</html>
I can't get the model data binded into the DataView store. The TextFieldFor Works perfectly.What I'm doing wrong?
Thanks!
Last edited by fabricio.murta; Sep 17, 2016 at 12:35 AM.