asp.net - Alert the user if value exists in database after user leaves textbox -
i have textbox on form. when user leaves textbox, he/she informed value he/she entered exists. values stored in sql server database.
i have found similar here.
it works ok, causes postback.
here did.
first added onblur on aspx textbox function call. like:
<asp:textbox id="id" onblur="myfunction()" <br/>
in javascript added function:
function myfunction() { var id= document.getelementbyid('textboxid').value; if (parseint(id)) { pagemethods.functionincodebehind(klid,success,failure); } function success(response) { alert ('success'); } function failure (response) { alert('failure'); }
in code behind created function:
<system.web.services.webmethod()> _ public shared function functionincodebehind(byval bo integer) integer dim integer ' stuff return return end function
it works.
Comments
Post a Comment