passwordvaluetextbox.cs

来自「《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含」· CS 代码 · 共 27 行

CS
27
字号
//------------------------------------------------------------------------------
// <copyright file="PasswordValueTextBox.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;

namespace System.Web.Administration {
    // A password text box that would retain its text as asterisks shown in the
    // textbox so to have the desired UI effect.
    [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public class PasswordValueTextBox : TextBox {
        protected override void AddAttributesToRender(HtmlTextWriter writer) {
            TextMode = TextBoxMode.Password;
            base.AddAttributesToRender(writer);
            string s = Text;
            if (s.Length > 0) {
                writer.AddAttribute(HtmlTextWriterAttribute.Value,s);
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?