ASPNet 2.0 TextBox mask question

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

In the C#.Net 2.0 WebForm standard TextBox Control, is it possible to has
the input look like * whenever we keyin?
Also, does it have an event like OnEnter for 'Enter'?
Thanks for help.


Jason
 
In the C#.Net 2.0 WebForm standard TextBox Control, is it possible to has
the input look like * whenever we keyin?
TextMode="Password"

Also, does it have an event like OnEnter for 'Enter'?

One may detect enter key like following (however it is usually not a
proper way, if one has to detect enter key like this, then there has
probably been some mistake in document/object model).

<asp:TextBox runat="server" id="txtSampleTextBox"
onkeypress="KeyPressHandler(event)" />

//in javascript
function KeyPressHandler(e)
{
var keynum;
if(window.event) // IE
{
keynum = e.keyCode;
}
else if(e.which) // Netscape/Firefox/Opera
{
keynum = e.which;
}
if(keynum == 13)
{
// Ok this is 'Enter' key, do here whatever required for
'Enter' (perhaps call OnEnter() !! )
}
}
 
Hi,

In the C#.Net 2.0 WebForm standard TextBox Control, is it possible to has
the input look like * whenever we keyin?

You can hide the password by setting the TextMode property of the
password text box to Password.
 
Back
Top