what is the .net code for adding year in this form like 2001-2002,2002-2003, in dropdown with the asp.net

Recommended Answers

protected void Page_Load(object sender, EventArgs e)
    {
        this.DropDownList1.Items.Add("Orange");
        this.DropDownList1.Items.Add("Grapes");
        this.DropDownList1.Items.Add("Apple");
        this.DropDownList1.Items.Add("Mango");
        this.DropDownList1.Items.Add("Lemon");
        this.DropDownList1.Items.Add("Banana");

}
Jump to Post

All 2 Replies

protected void Page_Load(object sender, EventArgs e)
    {
        this.DropDownList1.Items.Add("Orange");
        this.DropDownList1.Items.Add("Grapes");
        this.DropDownList1.Items.Add("Apple");
        this.DropDownList1.Items.Add("Mango");
        this.DropDownList1.Items.Add("Lemon");
        this.DropDownList1.Items.Add("Banana");

}

That can also be done in a simple for loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.