ASP.NET MVC Editing A Collection Best Practices - Your Opinion -


given following class, opinion on best way handle create/edit attributes.count can number.

public class product {   public int id {get;set;}   public string name {get;set;}   public ilist<attribute> attributes {get;set;} }  public class attribute {   public string name {get;set;}   public string value {get;set;} } 

the user should able edit both product details (name) , attribute details (name/value) in same view, including adding , deleting new attributes.

handling changes in model easy, what's best way handle ui , actionmethod side of things?

use formcollection , iterate through key/value pairs. presumably can use naming scheme allow determine key/value pairs belong attribute set.

[acceptverbs( httpverb.post )] public actionresult whatever( formcollection form ) {  .... } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -