i have a drop downlist ...i want to show last 5 years in that and the selected year should be 1434(1434 is the current new arabic year as from arabic month muharram arabic new year starts..1434 is 2013 of Gregorian)
i want dropdown to be auto like if the next year come i.e. 1435 it should automatically show in dropdown 1435.
int year =Convert.ToInt32(DateTime.Now.ToString("yyyy", new System.Globalization.CultureInfo("ar-sa")));
DropDownList1.DataSource = Enumerable.Range(year - 5, 6);
DropDownList1.DataBind();
developer27
Member
396 Points
205 Posts
auto year in dropdownlist
Nov 25, 2012 07:00 AM|LINK
i have a drop downlist ...i want to show last 5 years in that and the selected year should be 1434(1434 is the current new arabic year as from arabic month muharram arabic new year starts..1434 is 2013 of Gregorian)
i want dropdown to be auto like if the next year come i.e. 1435 it should automatically show in dropdown 1435.
Any 1 can help ? :-)
urenjoy
Star
12307 Points
1852 Posts
Re: auto year in dropdownlist
Nov 25, 2012 09:39 AM|LINK
Try following:
int year =Convert.ToInt32(DateTime.Now.ToString("yyyy", new System.Globalization.CultureInfo("ar-sa"))); DropDownList1.DataSource = Enumerable.Range(year - 5, 6); DropDownList1.DataBind();