@Html.HiddenFor() does not retain value

773 Views Asked by At

in my view all data is coming from viewmodel and the viewmodel consist of following:

  public class Coursework
{
   public virtual PortfolioMaster prtfMaster { get; set; }
   public virtual bool uploadfile { get; set; }
    public virtual string filename { get; set; }
}

when i use this in my view as shown:

   @Html.HiddenFor(model => model.prtfMaster.CourseID)
    @Html.HiddenFor(model=>model.filename) 
    @Html.HiddenFor(model=>model.uploadfile)

it is not retaining value for filename and uploadfile but in my view if i use @if(Model.uploadfile) it is giving me appropriate value

Can anybody tell me why this is happening? How can i retain the value of model.filename

0

There are 0 best solutions below