Getting Text property in codebehind from ASP.NET TextBox with TextMode = Password
I have a <asp:TextBox
with TextMode="Password"
. How can I read the value that the开发者_Go百科 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)
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
there has to be something else going on. I have no problems getting the value in TextBox.Text
.
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()?
精彩评论