如何通过选择月份在gridview中添加列? [英] How to add columns in gridview by selecting month?
本文介绍了如何通过选择月份在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,
这篇关于如何通过选择月份在gridview中添加列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文