Click here to Skip to main content
Rate this: bad
good
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 asp.net 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
Comments
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
good
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++)
        {
            GridView1.Columns.Add(bf);
        }
  Permalink  
Comments
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 215
1 George Jonsson 175
2 Kornfeld Eliyahu Peter 159
3 PIEBALDconsult 110
4 Richard MacCutchan 85
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 19 Oct 2012
Copyright © CodeProject, 1999-2014
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