<asp:DropDownList ID="dropDate" runat="server">
</asp:DropDownList>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindDateDropDown();
dropDate.DataSource = BindDateDropDown();
dropDate.DataBind();
dropDate.Items.Insert(0, new ListItem("--Select--", ""));
}
}
private object BindDateDropDown()
{
return Enumerable.Range(1, 31);
}
}