views:

931

answers:

3

I'm new to .NET and my first project is to create a event calendar to be populated from a events table in mSQL. I know there is a calendar object in the standard components but wondered if i'm better off populating a table view manually as i didn't know if there were lots of limitations to the standard object/component.

Thanks for your help

+1  A: 

You can use the standard calendar control. It will give you the ability to perform code in each cell (day) creation, so you can query your DB, find your dates, and during that paticular date's load, you can write any necessary content inside the cell.

TheTXI
+2  A: 

This can be done quite easily with the built-in calendar control that .NET provides. You're basically dealing with the DayRender event.

An excellent example can be found here: http://www.c-sharpcorner.com/UploadFile/munnamax/DatabaseDriven08212007012112AM/DatabaseDriven.aspx

John Rasch
thank you, appreciate the link. Once i've finished the full working system i'll put a link to a project file to help others
Andi
A: 

The link posted above is a good starting point but it retreives all the events from the database not just for the current month. In the example the events are retieved during the page_load function. What i need to do is get the current calendar month and use that within the query.

I can't seem to find where to call my getEvents() function to access the calendar current month, any ideas?

i'm using: MessageBox.Show( Calendar1.VisibleDate.ToString() ); to get the calendar date but it always returns 01/01/0001 00:00 im assuming because the calendar object hasn't intialised. I've tried calling my getEvents code from the calendar load method but it still doesnt work. Any pointers on this would be great :)

Andi