Click here to Skip to main content
16,018,249 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
good afternoon friends,
i have bind dropdownlist with method(the method display date and time in dropdownlist like this
HTML
(9/5/2012 12:00:00am,9/12/2012 12:00:00am,9/21/2012 12:00:00am 10/5/2012 12:00:00am,10/5/2012 12:00:00am and 11/25/2012 12:00:00am,11/30/2012 12:00:00am)

i want to display in dropdownlist like
September,October,November and so on.............
only single month will be display in dropdownlist
C#
DropDownList.DataTextField = "StartDate";

please help me some hints or links

if we have two or more dates in a month only single month display for all
Added you code, use improve question
C#
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { 
vt.TAuthOccuList dlocc = new vt.TAuthOccuList();
dlocc = ab.GetWebOccurrencesForProgrammeAndDates(Session["token"].ToString(), Convert.ToInt32(Session["ddldate"].ToString()), DateTime.Now, DateTime.Now.AddMonths(8)); DropDownList2.DataSource = dlocc.OccuList; DropDownList2.DataValueField = "occur_id"; DropDownList2.DataTextField = "StartDate"; DropDownList2.DataBind();}
Posted
Updated 23-Aug-12 1:23am
v5
Comments
Sachin Gargava 23-Aug-12 6:07am    
is your date come from database ?
Kishanthakur 23-Aug-12 6:32am    
no because i am using api from other server
Anuja Pawar Indore 23-Aug-12 6:40am    
Added code block

1 solution

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {       
        string CurrentMonth = String.Format("{0:MMMM}", DateTime.Now);
        string a = "";
        a = CurrentMonth;

        DropDownList1.DataSource = a;
        DropDownList1.DataBind();
    }
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900