0

I have the below code in my model and I want to make it required just I can other data types like string by adding [Required] but it is not working on this type.

public HttpPostedFileBase Docs
{
get;
set;
} 

@Html.FormTextBoxFor(m => m.Docs) this is how I am creating it in the view.

Can someone please tell me what I have to do so that it displays a Required attribute for the HttpPostedFileBase type.

Thanks

sp9
  • 755
  • 3
  • 11
  • 22
  • I have a lot of model bindings like this that I wanted this solution for. Is there no other better solution than adding javascript to all the bindings. – sp9 Jul 01 '15 at 14:50
  • You would need to check both client and server side. Can you post your custom FormTestBoxFor HTML helper? I'll see what I can come up with. – Brad C Jul 01 '15 at 15:16
  • 2
    http://stackoverflow.com/questions/6126472/is-there-a-way-to-validate-incoming-httppostedfilebase-files-in-mvc-2 this worked for me. Thanks – sp9 Jul 01 '15 at 15:24

0 Answers0