Binding Date vlues to dropdownlist using Specified Range

Sandhyab
Posted by Sandhyab under ASP.NET category on | Points: 40 | Views : 967
 <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);
}


}

Comments or Responses

Login to post response