Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
good afternoon friends,
i have bind dropdownlist with method(the method display date and time in dropdownlist like this
(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 22:15pm
v2

1 solution

I am not sure if i understood your requirement correctly.
If you want a list of months to be displayed in the drop down you can just add them as shown below

XML
<asp:DropDownList ID="ddlMonths" runat="server">
    <asp:ListItem Text="January" Value="1"></asp:ListItem>
    <asp:ListItem Text="Febuary" Value="2"></asp:ListItem>
    <asp:ListItem Text="March" Value="3"></asp:ListItem>
    <asp:ListItem Text="April" Value="4"></asp:ListItem>
    <asp:ListItem Text="May" Value="5"></asp:ListItem>
    <asp:ListItem Text="June" Value="6"></asp:ListItem>
    <asp:ListItem Text="July" Value="7"></asp:ListItem>
    <asp:ListItem Text="August" Value="8"></asp:ListItem>
    <asp:ListItem Text="September" Value="9"></asp:ListItem>
    <asp:ListItem Text="October" Value="10"></asp:ListItem>
    <asp:ListItem Text="November" Value="11"></asp:ListItem>
    <asp:ListItem Text="December" Value="12"></asp:ListItem>
    </asp:DropDownList>
 
Share this answer
 

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