Hiiiiii
I have some problem for binding month year in drop downlist in dynamically?
I want to bind month and year in this format
example:- Oct-13
and when the next month will come then bind like this Nov-13
plz help thanx
Loading
ranjan sahooPosted Oct 23, 2013, 6:04 AM
// Get the en-US culture. CultureInfo ci = new CultureInfo("en-US");
// Get the DateTimeFormatInfo for the en-US
culture. DateTimeFormatInfo dtfi = ci.DateTimeFormat;
var months = dtfi.AbbreviatedMonthGenitiveNames;
for(int i=13; i< 20; i++)
{ for (int j = 0; j< months.Length-1; j++)
{ ddl_date.Items.Add(string.Format("{0}-{1}", months[j], i); } }
ranjan sahooPosted Oct 23, 2013, 1:14 AM
after that i have create a method
i want to bind the system month and year in this format in the dropdownlist when the page is load
format is Oct-13 this is current month
then next month it will bind like Nov-13 then next month Dec-13 then next Jan-14
like that . plz give me the complete code
Thax
ranjan sahooPosted Oct 23, 2013, 1:07 AM
Jaganathan BantheswaranPosted Oct 22, 2013, 9:42 AM
Try like this,
// Get the en-US culture.
CultureInfo ci = new CultureInfo("en-US");
// Get the DateTimeFormatInfo for the en-US culture.
DateTimeFormatInfo dtfi = ci.DateTimeFormat;
var months = dtfi.AbbreviatedMonthGenitiveNames;
for(int i=13; i< 20; i++)
{
for (int j = 0; j< months.Length-1; j++)
{
ddl_date.Items.Add(string.Format("{0}-{1}", months[j], i);
}
}
ranjan sahooPosted Oct 22, 2013, 8:36 AM
Gomathi PalaniswamyPosted Oct 22, 2013, 8:29 AM
You could split the date and combine it in string.
Else,try this
string date= String.Format("{0:MMM/yy}", Date);
use date in binding drop down.It;s working for me.
Thanks
Gomathi
ranjan sahooPosted Oct 22, 2013, 8:09 AM
ranjan sahooPosted Oct 22, 2013, 8:04 AM
Jaganathan BantheswaranPosted Oct 22, 2013, 7:55 AM