Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hiii friends,

i have some issue binding date into dropdownlist
the date is coming through array items like datetime formats but i want to bind dropdownlist
like
January
February
march
April
and so on......
how to find date like this
3/1/2012,5/1/2012,15/1/2012 into January,
3/2/2012,5/1/2012,15/2/2012 into February
25/3/2012,23/3/2012 into March
how to find all dates in array and bind dropdownlist
jan
feb
march
and so on
Posted
Comments
__TR__ 30-Aug-12 6:25am    
Check how to get month in words from date here[^]
Kishanthakur 30-Aug-12 6:52am    
a litle bit help for me
thanks

hiii,

Your Sample Code is
C#
string[] standardToolBoxArray = new string[5] { "String1", "String2", "String3", "String4", "String5" };  
DropDownList1.DataSource = standardToolBoxArray;  
DropDownList1.DataBind();
 
Share this answer
 
v2
i have just array put on loop
and then change the format of date
and then
the filter the dropdownlist
 
Share this answer
 
Comments
Sandeep Mewara 30-Aug-12 8:55am    
This is not an answer. Please use 'Have a Question or Comment' link to respond to an answer. It will notify answerer of your comment such that he can come back and reply. Or if needed, use Improve Question link to edit/update your question at anytime.
Try this:
C#
string[] Months = new string[MyArray1.Items.Count]{};
int i = 0;
foreach(var date in MyArray1){
     Month[i] = (Convert.ToDateTime(date)).ToString("MMMM");
     i++;
}
DropDownList1.DataSource = Months;
DropDownList1.DataBind();



--Amit
 
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