Click here to Skip to main content
11,706,728 members (33,620 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#2.0 ASP.NET
I have to select month of a calendar, columns must be automatically generate in grid view with respect to the no of days of selected month and year using with C#. I got the no of days in a month. If i select "may" 31 columns must be generated in gridview. If i select "June" 30 columns must be generated in gridview.
Posted 18-Oct-12 18:17pm
Wes Aday at 19-Oct-12 0:24am
Okay and? Perhaps you meant to ask some sort of a question?
AishwaryaShetty at 19-Oct-12 1:08am
I dint get you.?. Can you check it out once.
Wes Aday at 19-Oct-12 5:56am
I did check it out. That exactly how I knew that you did not ask any sort of a question.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try this..

may help u.

Int32 day,mon,yr;
//Public declaration

// on any event where u need to generate

BoundField bf = new BoundField();
       mon = Calendar1.SelectedDate.Month;
       yr = Calendar1.SelectedDate.Year;
       day = DateTime.DaysInMonth(yr, mon);
       for (int i = 1; i <= day; i++)
AishwaryaShetty at 19-Oct-12 8:28am
I tried it but its not generating columns in gridview. Should i add any namespace?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 146
1 Sergey Alexandrovich Kryukov 140
2 chainerlt 110
3 Mika Wendelius 80
4 ppolymorphe 71
0 OriginalGriff 9,190
1 Sergey Alexandrovich Kryukov 8,407
2 CPallini 5,189
3 Maciej Los 4,756
4 Mika Wendelius 3,686

Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 19 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100