Textbox using textmode password not showing text asp.net c#

后端 未结 7 2109
刺人心
刺人心 2021-01-31 18:20

I have a few buttons on a web form, and when the user clicks them they will update the the textbox. This worked till I added the textmode = password. Now the textbox doesn\'t sh

7条回答
  •  情书的邮戳
    2021-01-31 18:46

    How desperate are you?

    If you're not desperate enough to try anything, anything to get it to work, don't read on. This will not be nice. OK? OK.

    The trick is to make the web app think that it's not a password box. In other words, don't use TextMode="password".
    Then in Page_Load, put txt_punch.Attributes["type"] = "password"

    That's it. The browser will know it's a password field (and show asterisks or dots), but the server side won't know, so it will send the content to the client as it it were plain text. Of course, this will also put the password in the page source...

提交回复
热议问题