Saturday, 7 July 2012

Beginning .Net : Password textbox in asp.net

You need this password textbox where you would like you insert username and password from website users. With the help of this password textbox inputed password character is not see on textbox , it will display astrik "*" or other special characters.
This is very useful article for .Net Beginners.

Here is example for this.
In this example we take two textbox one is for username and second is for password. Username password is normal textbox and password textbox is special password type textbox. There is a "TextMode"  property of textbox , you canse this property as "password" like this TextMode="Password" , by doing this your textbox is converted to password type textbox.

ASPX Code : 
        <table>
            <tr>
                <td>
                    User Name :
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtUserName"></asp:TextBox></td>
            </tr>
            <tr>
                <td>
                    Password :</td>
                <td>
                    <asp:TextBox runat="server" ID="txtPassword" TextMode="Password"></asp:TextBox></td>
            </tr>
        </table>

Output : 

You can see in the output image, In password textbox you did not see password in plain text , this will display in special characters.

Note : Give Us your valuable feedback in comments. Give your suggestions in this article so we can update our articles accordingly that.


No comments:

Post a Comment