asp.net MVC中Bind特性的使用
来源:互联网 发布:广域网优化技术 编辑:程序博客网 时间:2024/05/20 22:29
原文地址:http://stackoverflow.com/questions/8892550/bind-attribute-include-and-exclude-property-with-complex-type-nested-objects
This is my model:
public class FooViewModel { public Enquiry Enquiry { get; set; }}public class Enquiry { public int EnquiryId { get; set; } public string Latitude { get; set; }}
HTTP Post action:
[ActionName("Foo"), HttpPost]public ActionResult Foo_post( [Bind(Include = "Enquiry.EnquiryId")] FooViewModel foo) { return View(foo);}
View:
@using (Html.BeginForm()) { @Html.TextBoxFor(m => m.Enquiry.EnquiryId) @Html.TextBoxFor(m => m.Enquiry.Latitude) <input type="submit" value="push" />}
Does not work at all. Can I only make this work if I define the BindAttribute
forEnquiry
class as it is stated here:
上边是用在Action操作方法中的参数中使用,
或者在Model类上使用
[Bind(Include="EnquiryId ")]public class Enquiry { public int EnquiryId { get; set; } public string Latitude { get; set; }}
- asp.net MVC中Bind特性的使用
- Asp.net MVC 中Ajax的使用
- ASP.NET MVC中DROPDOWNLIST的使用
- ASP.NET MVC中DropDownList的使用
- [Asp.net mvc]Asp.net mvc 中使用LocalStorage
- [Asp.net mvc] 在Asp.net mvc 中使用MiniProfiler
- ASP.NET MVC - Model Bind机制浅析
- Asp.net Mvc 中使用Repeater的6种解决方案
- Asp.net MVC 中使用Repeater的6种解决方案
- 详解ASP.NET MVC中DropDownList的使用
- 详解ASP.NET MVC中DropDownList的使用
- IIS中使用ASP.NET MVC的经验总结
- IIS中使用ASP.NET MVC的经验总结
- Asp.net Mvc 中使用Repeater的6种解决方案
- ASP.NET MVC 中 Ajax.ActionLink 的使用
- IIS中使用ASP.NET MVC的经验总结
- Asp.net MVC中关于@Html标签的使用
- 在 ASP.NET MVC 中使用带后缀的 URL
- java环境变量设置
- 分析oracle主键的跳号现象
- 连接池中的maxIdle,MaxActive,maxWait参数
- java服务器在Linux下实现负载均衡
- cocos3d加载3Dmax模型到ios中
- asp.net MVC中Bind特性的使用
- OCCI入门(VC2010下配置)
- asterisk
- emacs 2.4安装问题 ecb
- jquery ajax使用小结
- 接口隔离原则
- 八款JS框架介绍及比较
- android loginDemo +WebService用户登录验证
- 【QTP】无意中发现了QTP11.5(UFT)的一个新功能。