Link to home
Start Free TrialLog in
Avatar of strickdd
strickddFlag for United States of America

asked on

Bind to Password Textbox

I have a formview that I want a user to be able to update a password with. I want to bind the oringinal password to a textbox with the textmode set to password, but when I try this is doesn't bind. I have the textbox control below:

<asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>' TextMode="password" ReadOnly="true" />

Any ideas?
Avatar of TornadoV
TornadoV
Flag of United States of America image

For security reason, TextBox with TextMode="Password" setting cannot be assigned or populated via the Text property on Page_Load or PostBack event.

Also, TextMode = "Password" can only be set @ design time.

You have a couple fo options if you're using AspNetSqlMembershipProvider.  Perhaps you can utilize password retrieve/reset options: http://www.qualitydata.com/products/aspnet-membership/help/configuration/asp-net-sql-membership-password-administration.aspx

Here are couple of other links:
http://forums.asp.net/thread/1412114.aspx
http://www.odetocode.com/Articles/427.aspx

Hope this helps.
Avatar of strickdd

ASKER

I found a work around because I am NOT using ASP.Net security. What I ended up doing is binding to a textbox that I set the Visible property to false. It is not rendered clientside and the text cannot be viewed by the client, but it maintains the e.OldValues[] when Updating.
Good, keep in mind that hidden text box with password is still visible in the 'View Source'.  I would at least use some kind of encryption.
I wasn't able to find the control or the value in the control when i viewed the source
you're right, I got it confused with display:none, with Visible = false server side control is not rendered.  My bad, it's too early for me.:)
ASKER CERTIFIED SOLUTION
Avatar of DarthMod
DarthMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial