ASP.NET : Change DropdownList font Size programmatically

Introduction

FontSize enumeration specifies the font sizes defined by HTML 4.0 . This enumeration available in System.Web.UI.WebControls.FontSize. There are many enumeration value available in FontSize enumeration those are shown below:

ASP.NET : Change DropdownList font Size programmatically


Complete code :

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
       
        DropDownList1.Font.Size =FontUnit.XLarge;
   
   
       
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownList1" runat="server" Height="20px" Width="124px">
            <asp:ListItem>Hyperlink</asp:ListItem>
            <asp:ListItem>CheckBox</asp:ListItem>
            <asp:ListItem>Label</asp:ListItem>
            <asp:ListItem>Panel</asp:ListItem>
        </asp:DropDownList>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Change Font size Dynamically"
            onclick="Button1_Click" />
        <br />
        <br />
    </div>
    </form>
</body>

</html>
Output
ASP.NET : Change DropdownList font Size programmatically

ASP.NET : Change DropdownList font Size programmatically

ASP.NET : Change DropdownList font Size programmatically ASP.NET : Change DropdownList font Size programmatically Reviewed by Jacob Lefore on October 21, 2013 Rating: 5

No comments