开发者

ASP.NET MVC2 form to object data binding utility

I run application business logic in CRM 2011 for now I need to create a web page to allow th开发者_如何学编程e public users to create orders etc. from ASP.NET application and save them in CRM.

I'm playing with CRM web services, I even created a couple of forms by the way I'm looking for data binding mechanisms or tools to map the submitted form values into appropriate CRM Entity e.g. Order.

How bind forms to CRM entities?

Sultan


If you've just started using MVC then perhaps you are not familiar with model binding. Basically MVC will map the contents of a request (post or get) to a strongly typed object for you. At it's simplest this is achieved (automatically and 'behind the scenes' by matching the name / key of an item in a request to the name of a property on your object. Here's a quick video showing how model binding works (over just working with the form collection directly). And this article goes into the detail of enabling basic CRUD functionality for a given model. Reading this should give you a sense of working with models, having your views strongly typed so you can make the model binding work easily.

I would also recommend you read up on validation with data annotations attributes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜