Now, I can show and update a model if I know its name and value. For example, here is my Student model:
public class Student
{
public string Name { get; set; }
public bool Sex { get; set; }
public bool Address { get; set; }
}
And, here is what I have in my View:
@Html.TextBoxFor(model => model.Name)
@Html.TextBoxFor(model => model.Sex)
@Html.TextBoxFor(model => model.Address)
I want to show and update a model, but I do not know how many attributes it has and what their names and values are. For example, if I return a Fruit model to the view, I will need to show and update its attributes like Price or Weight. If I return a Student model, I'll need to show and update attributes like Name, Sex, and Address. I have more than ten models in my project. My boss says that I can use key and value like Dictionary<string,string>
this way, and iterate through the model attributes, but I do not know how to do it.