↑ Grab this Headline Animator

Saturday, August 9, 2008

How to set value to a textbox with textmode as password from code behind

If we have a textbox with text mode as password and if we want set value(Password) from code behind file(.cs file) then we should do like this for showing text as "*****" in the UI.

TextBox1.Attributes.Add("value", "passwordfromDB");

Submit this story to DotNetKicks


Anonymous said...

I think this is correct

TextBox1.TextMode = TextBoxMode.Password;

Anonymous said...

TextBox1.TextMode = TextBoxMode.Password;

Is used to set the TextMode for TextBox but we cannot set text in passord mode from backend i.e this will not work...

TextBox1.TextMode = TextBoxMode.Password;
TextBox1.Text = "MyPassword";

you have to use like this
TextBox1.Attributes.Add("value", "MyPassword");

Try once

Post a Comment

Post your comments/questions/feedback for this Article.


Latest Articles