In this post we are going to learn how to change TextBox Control Font Size, TextBox Color, Background all style of Textbox control in ASP.Net TextBox Example.
First, Design the Page with One TextBox control along with 2 Button Control.
Write below code in Body tag :
The Design form look like below screen.
– Now write the Below code in Style1 Button Click Event:
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.ForeColor = System.Drawing.Color.Red;
TextBox1.Font.Size = 17;
TextBox1.Font.Bold = true;
TextBox1.BackColor = System.Drawing.Color.Yellow;
}
The ASP.NET TextBox Example Output is :
– Write Below code in Style2 Button Click Event :
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.ForeColor = System.Drawing.Color.Green;
TextBox1.BackColor = System.Drawing.Color.White;
TextBox1.Font.Underline = true;
TextBox1.Font.Italic = true;
TextBox1.Font.Bold = false;
}
The ASP.Net TextBox Example Result is :
– In this ASP.NET Texbox Example post we got the knowledge about how to change TextBox Font Size and all Textbox style in ASP.Net
– Hope you enjoyed this ASP.Net TextBox Example Tutorials.