c# - How to make textbox visible when previous textbox contains text -
i have webform in need place around 30 textboxes enter barcode scanned data. making first textbox visible , want next textbox visible when previous textbox filled text. tried using 'if' condition in textbox on selected change doesn't work. solutions?
you should use java-script because if use server side function go server many times application performance decrease.
so create java-script function accept 1 argument. argument take next text box id (text box u want display). call javascript function this:- onkeyup="calgrid(this,"textbox2");" pass nexttextbox id in place of textbox2...
<script type="text/javascript" language="javascript"> function calgrid(firsttextbox,nexttextbox) { var id=firsttextbox.id; var lastindex= id.lastindexof("_"); var strclnt=id.slice(0,lastindex+1); var txtboxvalue=document.getelementbyid(firsttextbox).value; if(txtboxvalue!="") { document.getelementbyid(strclnt+nexttextbox).style.visibility='visible'; } else { document.getelementbyid(strclnt+nexttextbox).style.display = "none"; } } </script> note:- if visible=false textbox property cannt visible=true javascript. set style textbox style="display:none"
Comments
Post a Comment