In HTML, I can add a placeholder attribute to input filed to show a hint to a user about the content of this input filed. but I am wondering if it's possible to add a hint text inside ASP.NET TextBox control?
To add a hint inside your TextBox in ASP.Net, you can easily use the "placeholder " keyword attribute as below
<asp:TextBox CssClass="form-control" ID="txt_Name" placeholder="your hint" runat="server"></asp:TextBox>
In code-behind, you can set a placeholder for a TextBox using C# as the following:
txt_Name.Attributes.Add("placeholder", "your hint");
txt_Name.Attributes["placeholder"] = "your hint";
Most popular tags