• How to show hide password characters in a TextBox in ASP.NET

    by  • May 5, 2014 • jQuery and Microsoft .NET, Microsoft ASP.NET • 0 Comments

    We have seen in many websites where we need to give password, we can see characters of our password by clicking a button or checking a checkbox.  Similarly, we can hide password by clicking on a button or un-checking checkbox. Normally a checkbox is used for this purpose. It is very easy to do in ASP.NET and it can be done purely from client-side JavaScript or jQuery code. So I have used jQuery to write this simple piece of code. I have used a CheckBox to show and hide characters in a TextBox but you can use a button if you want and write your code on that button click event.

    You need to download jQuery and add into your project. I have my jQuery file in Script folder.

    Create a website in Visual Studio in Visual Basic or C#

    Write following tag in between head tag of aspx page

    Write code below in between div tag

    Now add another script tag in between head tag and write code below

    Press F5 and see the result. You can download complete code sample from below link




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply