need to stop textbox onchange event if client side jquery function evalautes to false

Posted by Sharmagoldi781 under jQuery on 10/13/2014 | Points: 10 | Views : 1321 | Status : [Member] | Replies : 1
function txtAstonchange() {
var text = document.getElementById('<%= txtassetvalue.ClientID %>').value
if (text >= 1 && text <= 5) {
__doPostBack("txtassetvalue", 0);
else {
alert("Enter Value Between 1 and 5");
document.getElementById('<%= txtassetvalue.ClientID %>').value = document.getElementById('<%=hidtxtAst.ClientID %>').value
return false;


I have one text box I only want to do postback when value entered between 1 and 5 .but the problem here is that suppose at first value in text box is 4 and then change value and entered 8 in the text box .till this point this is working fine because value entered is not in range 1-5 its prompts the error msg and bind the hidtxtAst.ClientID to the text box .but here there is change in value from at starting 4 then entered value 8 and then hidtxtAst.ClientID value which is previous value i.e 4 so here it consider value change from 8 to 4 and postback occurs.i don't want this postback to occure


Posted by: Sharmagoldi781 on: 10/14/2014 [Member] Starter | Points: 25

is anybody has any idea about this?

Sharmagoldi781, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response