I have the following 2 classes:
public class SomeClass
{
public int SomeClassID { get; set; }
...
}
public class AnotherClass
{
public int AnotherClassID { get; set; }
public int AnotherClassText { get; set; }
}
I have a ViewModel that contains the following:
public class MyViewModel
{
public SomeClass { get; set; }
public List<AnotherClass> { get; set; }
}
I have a Strongly-Typed View of type MyViewModel
. I want to use DropDownListFor()
in order to have a list of AnotherClass
(value = AnotherClassID, text = AnotherClassText) and have whatever the user selects be assigned to the SomeClass.SomeClassID
How can I accomplish this?