1

I am working with a project where in I have a veiwmodel

    [Required(ErrorMessage = "Enter Title")]
    [Display(Name="Title")]
    public string Title { get; set; }

    [Required(ErrorMessage = "Enter Description")]
    [Display(Name="Description")]
    public string Description { get; set; }

    [Required(ErrorMessage = "Select Site")]
    [Display(Name = "Site")]
    public string Site { get; set; }

    [Required(ErrorMessage = "Upload File is required")]
    [Display(Name = "Upload File")]
    [ValidatePlanFile]
    public HttpPostedFileBase  File { get; set; }

    public int SelectedUser { get; set; }

    public List<Guid> Users { get; set; }

I need to assign the Users property to a hiddenfor.

Would it be possible to assign IENumerable to a view?

tereško
  • 58,060
  • 25
  • 98
  • 150
Ramppy Dumppy
  • 2,667
  • 7
  • 27
  • 37

1 Answers1

1

It is as usual how we do with @Html.TextBoxFor or others.

@model IEnumerable<Type>

@foreach(var item in Model)
{
    @Html.HiddenFor(model => item)
}
Ashwini Verma
  • 7,477
  • 6
  • 36
  • 56