tags:

views:

159

answers:

2

i want to set length of the textbox as 8. when the length is 8 keys become disabled. and also backspace enable.

A: 

If you are using ASP.NET, then simply set the MaxLength attribute to 8. On any textbox that will limit the number characters. In Windows Forms or WPF, TextBox controls also have a MaxLength property.

Thomas
+2  A: 

For an HTML text box

<input type="password" id="txtPassword" maxlength="8" />

For an asp.net textbox

<asp:TextBox MaxLength="8" TextMode="Password" runat="server" ID="txtPassword"></asp:TextBox>

For a Windows forms textbox

txtPassword.MaxLength = 8;
rahul