Click here to Skip to main content
11,923,958 members (66,404 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#2.0 C# 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 19:17pm
Wes Aday 19-Oct-12 0:24am
Okay and? Perhaps you meant to ask some sort of a question?
AishwaryaShetty 19-Oct-12 1:08am
I dint get you.?. Can you check it out once.
Wes Aday 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151125.3 | 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