Reputation: 4712
I have a <asp:TextBox
with TextMode="Password"
. How can I read the value that the user entered, using the codebehind?
I want to create a new user with code like this, but PasswordTextBox.Text
is always an empty string.
Membership.CreateUser(Username, PasswordTextBox.Text)
Upvotes: 1
Views: 1481
Reputation: 25073
That's correct. You're probably setting PasswordTextBox.Text = ''
in the Page_Load(). Don't do that if IsPostback() is true:
if not IsPostback() then
PasswordTextBox.Text = ''
end if
Upvotes: 2
Reputation: 11238
there has to be something else going on. I have no problems getting the value in TextBox.Text
.
Upvotes: 1
Reputation: 34563
There's nothing special about reading a password text box. I'm guessing the problem is somewhere else in your code. Do you happen to overwrite the values in the Page_Load()?
Upvotes: 1