2024-07-20 23:44:59 -04:00

41 lines
727 B
C#

namespace MBS.Web.UI.WebControls;
public enum TextBoxType
{
None,
Password
}
public class TextBox : WebControl
{
public TextBoxType TextBoxType { get; set; } = TextBoxType.None;
public TextBox(TextBoxType type = TextBoxType.None)
{
TextBoxType = type;
}
protected override string TagName => "input";
public string Name { get; set; }
private string GetTextBoxType()
{
switch (TextBoxType)
{
case TextBoxType.Password:
return "password";
}
return "text";
}
protected override IDictionary<string, string> GetControlAttributes()
{
IDictionary<string, string> dict = base.GetControlAttributes();
dict["type"] = GetTextBoxType();
dict["name"] = Name;
return dict;
}
}