简体   繁体   中英

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 the 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 eg 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM