开发者

Getting Text property in codebehind from ASP.NET TextBox with TextMode = Password

开发者 https://www.devze.com 2023-01-21 22:17 出处:网络
I have a <asp:TextBox with TextMode=\"Password\". How can I read the value that the开发者_Go百科 user entered, using the codebehind?

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()?

0

精彩评论

暂无评论...
验证码 换一张
取 消