Post back complex object from clent side?

ASP. NET MVC is capable of Model Binding complex objects and it's quite good at it. An easy way to do this is to name your view fields that same as the properties for your object.

That way in your action method that the form posts to you only need the complex object as a parameter. Example: % using(Html.BeginForm()) { %.

ASP. NET MVC is capable of Model Binding complex objects and it's quite good at it. An easy way to do this is to name your view fields that same as the properties for your object.

That way in your action method that the form posts to you only need the complex object as a parameter. Example: Which posts to an action method like so: public ActionResult Index(ComplexObject complexoObject) { } That's a fairly simple example as you could have different form controls in the view for corresponding properties of the object. If your object is very complex you could always write your own model binder for it and over-ride the default model binder.

Yeah, that's true. But what I'm posting back is a big questionaire which contains more than 100 questions. They are contained in a list.

How can I post that back? Thanks! – Roy Nov 13 '09 at 8:20 2 marcomagdy.Com/2009/09/03/… – queen3 Nov 13 '09 at 13:20 Check out queen3's link and take a look at "Binding to Collections of Simple Types" & "Binding to Collections of Custom Types".

If you name your form elements accordingly you can accept a list as a parameter and MVC will do the model binding to that list automatically. – DM. Nov 13 '09 at 13:44.

The entity will be detached. You will need to fetch the entity again, update the properties, and then commit the changes. Alternatively you could reattach the entity, but this can be tricky when you are dealing with multiple related entities being attached at the same time.

If this is the case for you, check out codeproject.com/KB/architecture/attachob....

I hope you are not doing that. First of all, this is not very user friendly.It involves a lot of scrolling down, user can get lost, its error prone and if something goes wrong he has to do it all over again. A better approach is one or few questions at a time.

With Next/Prev buttons for moving between them. You could make it even easier for yourself and forget about postbacks and go the AJAX way - issue a post request to some Json service the AJAX way. And save the progress after each question, so if something goes wrong user can resume later from where he left off.

It will be much more maintable, faster and user friendlier.

You could make it even easier for yourself and forget about postbacks and go the AJAX way - issue a post request to some Json service the AJAX way. And save the progress after each question, so if something goes wrong user can resume later from where he left off. It will be much more maintable, faster and user friendlier.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions