validation - Handling error messages using asp.net -


I have an asp.net page that contains a server side button and 2 text boxes which are only numeric values accept. Asp.net validation control.

If there are user types in non-numeric data in both text boxes, then how do I show only 1 error message on the page: "Only numeric values ​​are allowed." And I want to get it without firing server side events.

Thank you.

OK, you will need to do this with javascript.

I know whether the input is numerical or not, I do not know the exact javascript methods, I think you can use a regex. But you have a hidden device like

  & lt; Div id = "numericErrorMessage" class = "error" style = "display: none;" & Gt; Numeric value is only & lt; / Div & gt;  

Then you can do this:

  if (! Idar (text1) || ISNumber (text2) {document.getElementById (numericErrorMesage) . Style .display = 'block'; }  

Of course this is "pseudocodish", but I think this will work for you once you can check for a valid number of javascript and just use that location in the nominal function Keep


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -