Wednesday, 1 January 2014

How to get the Month Names in DropDownList in ASP.NET

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to get the Month Names in DropDownList in ASP.NET</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="ddlMonth" runat="server"   AutoPostBack="true">
            <asp:ListItem Value="0" Text="--Select--"></asp:ListItem>
            <asp:ListItem Value="1" Text="Jan"></asp:ListItem>
            <asp:ListItem Value="2" Text="Feb"></asp:ListItem>
            <asp:ListItem Value="3" Text="Mar"></asp:ListItem>
            <asp:ListItem Value="4" Text="Apr"></asp:ListItem>
            <asp:ListItem Value="5" Text="May"></asp:ListItem>
            <asp:ListItem Value="6" Text="June"></asp:ListItem>
            <asp:ListItem Value="7" Text="July"></asp:ListItem>
            <asp:ListItem Value="8" Text="Aug"></asp:ListItem>
            <asp:ListItem Value="9" Text="Sept"></asp:ListItem>
            <asp:ListItem Value="10" Text="Oct"></asp:ListItem>
            <asp:ListItem Value="11" Text="Nov"></asp:ListItem>
            <asp:ListItem Value="12" Text="Dec"></asp:ListItem>
        </asp:DropDownList>
        <asp:DropDownList ID="ddlDay" runat="server">
        </asp:DropDownList>
        <asp:Button ID="btnGetDate" runat="server" Text="Get date"  />
    </div>
    </form>
</body>
</html>



The output of the above code as shown in the below figure.
How to get the Month Names in DropDownList in ASP.NET

No comments:

Post a Comment

© 2012-2018 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.