怎样在textbox设为password时,填入预设值
来源:互联网 发布:手机上js刻度尺滑动 编辑:程序博客网 时间:2024/05/01 02:16
Pre-filling a TextBox control with TextMode="Password"
When the TextMode property of a TextBox control is set to Password, the value you assign to the Text property (either declaratively or programmatically) isn't actually displayed at runtime, not even in masked mode (with the * chars). This is of course done for security reasons, because even if the password would be shown in masked mode, the actual clear-text password could still be retrieved from the page's source HTML code.
However, there are times when you actually want to pre-fill the password field, for example in a "My Profile" page where the user can change his personal data, including his account's password. If you don't protect very sensitive information, you may decide that showing the password in masked mode is a good compromise to increase the user's experience. (The option of not showing the password at all and only update the password if the user types in something is not as intuitive for the user...). It would have been nice to have a direct option to show the password in masked mode but, as said, nothing appears if you set the TextBox's Text property. The trick is very simple though: you just have to manually add a "value" attribute to the HTML generated by the server-side textbox control, where the value is the password. You do this by accesing the control's Attributes collection, as shown below:
PasswordField.Attributes.Add("value", "secret")
- 怎样在textbox设为password时,填入预设值
- TextBox 在TextMode为"MultiLine"时怎样控制输入长度。
- TextBox属性设为Readonly时,.net后端程序无法取值的问题解决
- 如何在password类型的textbox上绑定密码值
- asp.net中TextBox设为只读后的取值问题
- asp.net中TextBox设为只读后的取值问题
- 在 Visual C# 中,怎样为 TextBox 控件添加水印文字
- 怎样在ubuntu中把windows设为默认启动项
- TextBox控件TextMode=Password时赋值
- TextBox控件TextMode=Password时赋值
- TextBox控件TextMode=Password时赋值 .
- 怎样设列的默认值为Now()
- .net 遍历页面中的所有textbox设为空
- Asp.net 中Password型TextBox在服务器赋值
- asp.net中的服务器端控件 textbox 设为只读属性后无法获取 javascript给其赋的值
- asp.net中的服务器端控件 textbox 设为只读属性后无法获取JS给其赋的值解决办法
- 在单击TextBox进入输入状态时,怎样使TextBox中原来的文字处于全选状态?
- TextBox Password Mode
- 九九乘法表程序
- http://www.betterfonts.com/
- 二战日军“窝囊废”师团:大战前官兵集体装病
- linux系统文件命令精通
- 抽象
- 怎样在textbox设为password时,填入预设值
- 我为什么不要应届毕业生
- 寻址的一些说明
- WWW攻击法
- ISAPI Extensions: Creating a DLL to Enable HTTP-based File Uploads with IIS
- FTP命令大全
- 再议C#中接口的作用
- VB6.0+MySQL4.1数据库编程
- 为什么房价只涨不跌惊人内幕! [转]