如何通过选择月份在gridview中添加列?
问题描述:
我必须选择日历的月份和年份,必须使用C#使用asp.net在网格视图中相对于所选月份和年份的天数自动生成列.
I have to select month and year of a calendar, columns must be automatically generate in grid view with respect to the no of days of selected month and year using asp.net with C#.
答
尝试一下,
Try this ,
DateTime Today = DateTime.Now;
int Year = Today.Year;
int Month = Today.Month;
int Days = DateTime.DaysInMonth(Year, Month);
GridView_Name.Columns.Add(Days);
谢谢
Thanks,