Raja

Raja

  • NA
  • 2k
  • 355.9k

How to validate if text box have only special character?

Sep 23 2016 2:54 AM
i want to validate the text box.this is text box contain item number availability check .if the user enters only special character like( !@#$%^&amp;+)(**)_)":}{?&gt; )throw the alert message.<br /><div> </div><div>item number : &nbsp;&nbsp; m_test-120</div> <strong>What I have tried:</strong><br /> <br /> i use <br /> <br /> Regex r = new Regex(@"[~`!@#$%^&amp;*()+=|\\{}':;.,&lt;&gt;/?[\]""_-]");<br /> if (r.IsMatch(tbxspirno.Text.ToString().Trim()))<br /> {<br /> Master.ShowMessage("Enter valid item number", MessageHelper.MessageType.Information);<br /> }

Answers (5)