473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

retrieving 'shown' month from calendar control

Okay, i have a datagrid that I want to populate with invoices that are
due on the month shown on the calendar, so what i need to do is
retrieve the current 'shown' month and create a couple of variables
that allows me to set the beginning date and end date of my range for
the query. This means when i click on July, the datagrid should
repopulate with all the invoices due in July. Here is the code I have
thus far in trying to get those values.

dim shownmonth as string = (need code to get shown month)
dim shownyear as string = (need code to get shown year)
dim beginrange as date = shownmonth & "/1/" & shownyear
Dim daysinmonth As Integer =
beginrange.DaysInMonth(shownyear,shownmonth)
Dim EndRange As Date = shownmonth & "/" & daysinmonth & "/" & shownyear

any help would be very appreciated!

Thanks,
Jeff

Nov 19 '05 #1
7 3505
oh, and my calendar control's ID is Calendar1

thanks,

Nov 19 '05 #2
You just get one date from the range of the dates and use
date.ToString("MM") - for Month and date.ToString("yyyy") for year.

See if this helps

"tfsmag" <tf****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Okay, i have a datagrid that I want to populate with invoices that are
due on the month shown on the calendar, so what i need to do is
retrieve the current 'shown' month and create a couple of variables
that allows me to set the beginning date and end date of my range for
the query. This means when i click on July, the datagrid should
repopulate with all the invoices due in July. Here is the code I have
thus far in trying to get those values.

dim shownmonth as string = (need code to get shown month)
dim shownyear as string = (need code to get shown year)
dim beginrange as date = shownmonth & "/1/" & shownyear
Dim daysinmonth As Integer =
beginrange.DaysInMonth(shownyear,shownmonth)
Dim EndRange As Date = shownmonth & "/" & daysinmonth & "/" & shownyear

any help would be very appreciated!

Thanks,
Jeff

Nov 19 '05 #3
hmm won't that just retrieve today's month and year values?

i need to get the month and the year on the calendar that is shown, so
that if i click ahead to the next month on the calendar it will
repopulate the grid with that month's invoices.

Nov 19 '05 #4
Did you try to handle VisibleMonthChanged event?
Look at the args there.

"tfsmag" <tf****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
hmm won't that just retrieve today's month and year values?

i need to get the month and the year on the calendar that is shown, so
that if i click ahead to the next month on the calendar it will
repopulate the grid with that month's invoices.

Nov 19 '05 #5
Did you try to handle VisibleMonthChanged event?
Look at args there
Shimon.
"tfsmag" <tf****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
hmm won't that just retrieve today's month and year values?

i need to get the month and the year on the calendar that is shown, so
that if i click ahead to the next month on the calendar it will
repopulate the grid with that month's invoices.

Nov 19 '05 #6
hmmm i'm kind of a newbie at asp.net, but when i try to put that event
in, the only args i get are for previous month and next month...

how do i account for this month and load the datagrid... if i bind the
datagrid inside that event will it not bring up the current month as
default?

Nov 19 '05 #7
What you get there is NewDate - this is the date that you need to use to
determine the month that Calendar will display.

You can use this event to Bind your datagrid.
I don't know any details about how you bind your grid and to what but what
ever you do you need to pass NewDate.Month as parameter.

In any case you will need to try to see if it works for you.
Shimon.

"tfsmag" <tf****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
hmmm i'm kind of a newbie at asp.net, but when i try to put that event
in, the only args i get are for previous month and next month...

how do i account for this month and load the datagrid... if i bind the
datagrid inside that event will it not bring up the current month as
default?

Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: msnews.microsoft.com | last post by:
Calendar Control: Changing the Month Display and Navigation Links http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskCustomizingCalendarWebControlAppearance.asp ...
1
by: bill yeager | last post by:
I would like to place the currently selected date (retrieved from the database) on a calendar control which is embedded inside a datagrid. However, I can't find the ID of the control to do so....
2
by: bb | last post by:
any way to prevent displaying the previous and next months in the calendar control? i have tried just blanking the text out in the dayrender IsOtherMonth and also dynamically changing the...
8
by: tfsmag | last post by:
i need to create a date range based on the current "shown" month on a calendar control to query a database and populate a datagrid based on that date range. how can i retrieve the "shown" month...
4
by: Jason Chan | last post by:
How can I get the month and year a calendar control current displaying? My problem is I want to load a list of event to a calendar so that it display difference style if there a event for a day....
4
by: stevebuy | last post by:
Hi, I hope I'm posting this in the right forum. I'm using a calendar control in a detailsview template (aspnet 2.0). Its bound to data but in the edit view it always displays the current month,...
0
by: larry | last post by:
I am in the process of rewriting one of my first PHP scripts, an event calendar, and wanted to share the code that is the core of the new calendar. My current/previous calendar processed data...
11
by: Randy | last post by:
I have a MonthCalendar on one of my forms. I have disovered that the DateChanged event is triggered not only when the user clicks on a new date, but also if they click on the Previous or Next...
5
by: =?Utf-8?B?bWFib25k?= | last post by:
Hi Using a month calendar control so that my user can select a start and end date for a range that will be used in a SQL query. Problem.....if user selects a date in one month and then scrolls...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.