Note that there are some explanatory texts on larger screens.

plurals
  1. POAsp.Net MVC View with Multiple strongly typed Partial View with Submits per partial view
    text
    copied!<p>I am trying to create a View in ASP.NET MVC in which different parts of a view model are modified separately to capture intent.</p> <p>For example, the modification on users can be done in one of the following ways at a time:</p> <ol> <li>Modify Name,</li> <li>Modify Email,</li> <li>Modify Password,</li> <li>Modify Status</li> </ol> <pre><code>public class UserEditViewModel { public string DepartmentDetails { get; set; } [HiddenInput(DisplayValue = false)] public Guid UserId { get; set; } public class UserNameEditModel { [Required(ErrorMessage = "Name Required")] [DisplayName("Name")] [StringLength(50, ErrorMessage = "Name must be less than or equal to 50 characters")] public string Name { get; set; } } public class UserPasswordEditViewModel { [Required(ErrorMessage = "Password cannot be Empty")] [DisplayName("Password")] public string Password { get; set; } [Required(ErrorMessage = "Confirm Password is Required")] [DisplayName("Confirm Password")] public string ConfirmPassword { get; set; } } public class UserStatusEditViewModel { [Required(ErrorMessage = "Status Required")] [DisplayName("Status")] public bool Status { get; set; } [Required(ErrorMessage = "Comment Required")] [DisplayName("Comment")] public string Comment { get; set; } } } </code></pre> <p>What I want to do its create strongly typed partial views based on <strong>outerclass+ one of inner classes</strong>. Each partial view will have its own form submission which will have action pointed out to a separate controller action (edit password, editname, editstatus...)</p> <p>I tried t0 create view based on <strong>outerclass+ one of inner classes</strong>, which is something I got in the automated view builder wizard but it was unable to resolve DepartmentDetails as well as UserID of outerclass.</p> <ol> <li>Is what I am wanting to do possible in ASP.NET MVC 2 / 3 Beta?</li> <li>I will use Ajax later on for enhancement but I would like to do as much form post without it.</li> <li>If it is possible to have separate forms on partial view work independently then I guess one solution might be to have User Id and Details on each of the EditviewModel and and have view use one single ViewModel.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload