So Here's what I'm trying to do.
I have a Calendar Control on one page - the user clicks on a date and goes to another page which displays the details from a diary database for the selected date - works fine so far !
Now, whilst on that second page I want to give the User the choice of displaying all diary entries for the month, or for the year. So I could create a further 2 separate pages that display a GridView for a particular Month or a particular Year but that seems a bit of an over kill.
How can I make the Grid View display from different queries or maybe dynamically change the query depending upon whether a Month or Year is selected?
So my start page with the Calendar Control has this code:
Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
If Page.IsPostBack Then
Response.Redirect("~/diaryPage.aspx?SelectedDate=" & Calendar1.SelectedDate)
After which the User gets taken to diaryPage.aspx with the Selected Date from the Calendar Control.
I then created a Table Adapter on the diary Page to query the diary Database with the Selected Date and drive the Grid View to display the details for that Selected Date.
View Complete Post