Setting the Value of a TextBox with TextMode=Password

Published 5 January 2009 16:30 by Ross in .NET
Tags:

When you are using a textbox for a password field in .NET and hence have its TextMode property set to 'Password' you cannot set the Text property of the textbox at runtime. This is a bit of a pain but is by design to prevent an unmasked password being displayed in the page.

Sometimes we may however want to override this behaviour. This can be done by simply setting the value attribute instead of using the Text property as below: 

PasswordText.Attributes.Add("value", "ThePassword");
 

 


   |    Kick It on DotNetKicks.com    |    Delicious Delicious |    |    E-mail

Comments

Add comment


 

  Country flag





Ross's Blog

Ross Mason is a software devloper who lives and works in Sheffield, UK.