asp.net - How to change a TextBox font name programmatically

Change TextBox font name
asp.net web server control's Font-Names property help us to set textbox control font. you also can change the textbox font name programmatically. Font-Names property hold a string value which represent a font names. even you can use google web font or any other web font as textbox font. see more documentation from specified web font vendor. google font is free and very fast to laod. you can use many standard font by default as textbox font such as Verdana, Tahoma, Comic Sans MS, Times New Roman, Book Antiqua, Palatino etc.
TextBoxFontName.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        TextBox1.Font.Name = "Verdana";
    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        TextBox1.Font.Name = "Tahoma";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to set, change TextBox font name</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">TextBox Example: Font Name</h2>
        <asp:Label 
             ID="Label1" 
             runat="server"
             Text="Favorite Color"
             >
        </asp:Label>
        <asp:TextBox 
             ID="TextBox1" 
             runat="server"
             Text="DarkGoldenrod"
             Font-Size="Large"
             ForeColor="SeaGreen"
             >
        </asp:TextBox>
        <br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server" 
             ForeColor="SaddleBrown"
             Text="TextBox Font Verdana"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
        <asp:Button 
             ID="Button2" 
             runat="server" 
             Font-Bold="true"
             ForeColor="SaddleBrown"
             Text="TextBox Font Tahoma"
             OnClick="Button2_Click"
             />
    </div>
    </form>
</body>
</html>
Related asp.net example