Prevent user to enter whitespace during form input in asp.net model validation? -


i have bee using model validation in asp.net mvc website. want have functionality prevent user entering whitespace in testbox , submit form.

there other validation attributes available, not find validation attribute prevents user entering whitespace in input textbox.

i develop custom attribute this, there method called regular expression validator think use achieve functionality. example: can set attribute has regular expression validating email. if user enters wrong email, message shown email format wrong.

i want use same, don't know regular expresison validates form input field if user enters whitespace.

please me kind of regular expression? thanks,

[regularexpression(@"[^\s]+")] public string data { get; set; } 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -