Click here to Skip to main content
15,032,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am using range validation control, in my text boxes accepts only below 10 numbers, If we enter any other numbers in that text box i need to display popup message (Error Message).If we enter any other numbers like 11,12...then we can display popup msg ,('Ols enter below 10 numbers').

It is possible to use popup message ?

Help me!!
anushripatil 21-Dec-11 0:03am
u can use an alert
[no name] 21-Dec-11 0:06am
Can u suggest me to how to display that alert!! I don't no how to write java script for that!!

you can write in this way :

<asp:textbox id="text1" runat="server" onkeypress="return isNumeric();" xmlns:asp="#unknown">

in script tag :
<script type="text/javascript">
function isNumeric() {
var num= parseInt(document.getElementById("<%=text1.ClientID %>").value);
          if (num >10) {
              alert("Please enter valid number.");
              return false;
return true;

Hope this will help you.
And don't forget to mark this as answer if it helps. :)
[no name] 21-Dec-11 0:50am
Thank you so much!! It's working!!
add this script

function validate(ctr)
var txt=document.getElementById(elementid).value;
if (parseInt(txt)>10)
alert('Number Should Be Less than 10');


add this script into textbox

Karthik Harve 21-Dec-11 0:14am
[Edit] pre tags added.
[no name] 21-Dec-11 0:25am
where i can declare this (onchange='validate(this)')
Tanveer A 22-Dec-11 0:48am
<asp:TextBox id="txt" runat="server" onchage="validate(this);"/>
Dear Murali,

Here you can go for Client scripting i.e., javascirpt alert box. You can send the textbox clientID as parameter to your javascirpt function where you can test that the text contained in it that id it has value greater than 10 then an alert box for the same can be showed.

Please mark this as your answer of it helps you.

there is one more method to do this..please use your range validation control using java script and there is a textbox property name Onblur() or OnTextChange().you can code on this event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900