【发布时间】:2014-08-26 22:24:40
【问题描述】:
当我单击更新按钮时,我得到了 TestCaseModel md 的空值。我无法找到我做错的地方。 (我正在尝试获取组合框的选定值)
我的模特
public class TestCaseModel
{
public Product pro {get;set;}
public List<ProductCatagory> lst { get; set; }
}
public class Product {
public string Name { get; set; }
public string Description { get; set; }
}
public class ProductCatagory {
public string ID { get; set; }
public string Name { get; set; }
}
我的控制器
public ActionResult Index()
{
TestCaseModel md = new TestCaseModel();
md.lst = new List<ProductCatagory> {
new ProductCatagory { ID="1",Name="science book"},
new ProductCatagory {ID="2",Name="cartoon book"}
};
md.pro = new Product {Description="here is the des.",Name="Book" };
return View(md);
}
[HttpPost]
public ActionResult Update(TestCaseModel md)
{
X.Msg.Notify(new NotificationConfig
{
Icon = Icon.Accept,
Title = "Working",
Html = md.pro.Name+">>"
}).Show();
return this.Direct();
}
我的看法
@Html.X().ResourceManager()
@Html.X().TextFieldFor(m=>m.pro.Name).Flex(1).FieldLabel("ID").Value(@Model.pro.Name)
@Html.X().ComboBox().FieldLabel("Urun katagori").Flex(1).Store(Html.X().Store().ID("Store41")
.Model(Html.X().Model().Fields(new ModelField("ID"), new ModelField("Name"))).DataSource(@Model.lst)
).ValueField("ID").DisplayField("Name").Value(@Model.pro.Name)
@Html.X().Button().Text("Update").Icon(Icon.PageSave).DirectClickAction("Update","TestCase")
【问题讨论】:
-
请发布堆栈跟踪
标签: asp.net-mvc ext.net