Last active
December 12, 2015 02:48
-
-
Save lohithgn/4701149 to your computer and use it in GitHub Desktop.
Custom Web Control - HTML5 TextBox control for adding placeholder support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DefaultProperty("Text")] | |
[ToolboxData("<{0}:Html5TextBox runat=server></{0}:Html5TextBox>")] | |
public class Html5TextBox : TextBox | |
{ | |
string _placeholder = "enter value"; | |
[Bindable(true)] | |
[Category("Appearance")] | |
[DefaultValue("enter value")] | |
[Localizable(true)] | |
public string Placeholder | |
{ | |
get | |
{ | |
return _placeholder; | |
} | |
set | |
{ | |
_placeholder = value; | |
} | |
} | |
protected override void AddAttributesToRender(HtmlTextWriter writer) | |
{ | |
writer.AddAttribute("placeholder", _placeholder); | |
base.AddAttributesToRender(writer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment