Follow by Email

Converting normal textbox into password textbox on clicking on the textbox

In this tutorial i will show how can u show the text in the textbox which is having TextMode=password but when clicked on that textbox it converts it to the password textbox.
Take one textbox & set its TextMode to password.
now go to source mode of visual studio write this in the textbox

onfocus="if(this.value =='PASSWORD')this.value='';" onblur="if(this.value==''){this.value='PASSWORD';this.TextMode='SingleLine';}"
After adding this what happens is .....
It will initially show text "PASSWORD".
After that when you click on it will be converted password textbox which will show text as "*"

your textbox markup should look something like this....

 < asp:TextBox ID="Password" runat="server" TextMode="Password"
="if(this.value =='PASSWORD')this.value='';" onblur="if(this.value==''){this.value='PASSWORD';this.TextMode='SingleLine';}">PASSWORD< /asp:TextBox>


Post a Comment