• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

I receive a validation message for textbox for string field before pressing submit, how to fix this?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I receive a validation message for textboxfor string field before pressing submit, how to fix this?


Hi, everyone. I am working on a c# mvc application. I validate a string property as Required in a ViewModel. Here is my code from the ViewModel:



Here is the code from the View:



The problem is that when I go to the view, the required error message is shown even though I haven't pressed submit, and I want it to be displayed only if I press Submit and haven't entered anything. How should I fix that?
reply
    Bookmark Topic Watch Topic
  • New Topic