I am creating a UserControl that will read data from an XML file and populate a ListBox. I’ve open up the .ascx file and would like to use @foreach (etc..) but this isn’t valid?
Can someone explain why this isn’t possible? Or maybe confirm if UserControls are deprecated in MVC 3?
.ascxis WebForms.@is Razor, meaning that if you want to write@foreach(...)you need a Razor template:Foo.cshtml:And if you want WebForms user control
Foo.ascx: