mvc razor complex object ( where to find help )
-
I have been a developer for many years non of which have been on web front end :( So i decieded to tackle one of the items on my "wanna know" list. this time it's mvc3 i am attempting to create simple crud for this objet( below ) but am suck on the "MyItems" list. I am looking for the create / edit to be created with one operation for both the MyClass properties + ( adding the line items for MyItems ). so far i've attemnpted to create a partial view which uses jquery to clone nodes to create a single item for MyItems and include that partial view in my Create view. however i am not getting the objet binding correct for when i submit the save, MyItems is always empty. Any pointers and links to tutorials etc on the matter are greatly appreciated Advice and solutions welcome as well :)
public class MyClass
{
public MyClass()
{
MyItems = new List<MyItem>();
}\[Required\] public string Name { get; set; } public int Age { get; set; } public List<MyItem> MyItems { get; set; } public class MyItem { public string Lable { get; set; } public string Value { get; set; } }
}