Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Sir,

Please help me on below query.
I have a "Year" calendar and "Year starts from" drop down list in ddl values are from January to December. If user select 'January' from "Year starts from" ddl, months should display From January To December. If user select 'March' from "Year starts from" ddl, months should display from March to February. If user select 'August' from "year starts from" ddl, months should display from August to July.,,,, like that I want to display in my view.
Please share any suggestions, how could I implement this.

Thank you very much in advance.
Posted
Updated 18-Aug-16 23:08pm
v2
Comments
Maciej Los 19-Aug-16 2:01am    
Do not post the same content in the "What have you tried?" window! It doesn't make sense at all!

If i understand you well... you want our help in query creation? What database engine?
Karthik_Mahalingam 19-Aug-16 2:07am    
calendar control or drop down list?
Member 12224368 19-Aug-16 2:21am    
not calendar control, it's drop down list and using Entity Framework.
I have created drop down list items and I want to change depends on selecting the month in ddl.
Karthik_Mahalingam 19-Aug-16 2:28am    
both are drop down controls?
one is year and other is month ?
Member 12224368 19-Aug-16 2:41am    
Year is calendar and month is drop down sir.
please help how to do that.

C#
public List<string> GetMonthNames(int startmonth)
{
    List<string> monthlist = new List<string>();
    if (startmonth < 1 && startmonth > 12)
        startmonth = 1;
    for (int i = 0; i < 12; i++)
    {
        int addon = 0;
        if (i + startmonth > 12)
            addon = 12;
        monthlist.Add(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName((i + startmonth) - addon));
    }
    return monthlist;
}pre></string></string></string>
 
Share this answer
 
Check Solution Edit fiddle - JSFiddle[^]
 
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