103yanira153line905
New Member
This is a theory question I suppose. Not even sure this is the right area, but anyway... <BR><BR>I'm making a calendar with information from a MySQL database. The database contains thousands of records. Now, the way I understand the OnDayRender event for the calendar control is that for each day displayed it calls the procedure for modifying the dates contents. <BR><BR>This means that, using a database, the procedure would end up making 42 (number of days visible on the calendar) calls to the database, and each call would have to search these thousands of records to find any that match that date. <BR><BR>My idea was to create a dataset (using a Page_Load sub) that only contained the data for the currently selecting month and use the OnDayRender event to access the dataset. I was unsuccessful, mostly because I couldn't figure out a way to have the dataset keyed off the calendar, which in the flow of things, hadn't been created yet. There was no way I could figure out to make the dataset update to the currently displayed month with out using the OnDayRender event, which means the dataset gets recreated 42 times...get the picture? <BR><BR>Now, this seems to me to be the ideal way to do it. For the month being displayed, create a dataset containing only the items between the 1st and last days of the month. Only 1 database call, but I couldn't figure out how to do it. <BR><BR>I'm curious what some of the gurus think about this and if anyone know of a solution using the calendar control that doesn't require the 42 database calls. Or maybe I'm just out in left field...that happens. <BR><BR>Anyway, thanks for you input and any assistance you can provide.I had the same problem with the calender. The way that I solved it was to make one call to the database for the calender month. This call would put the primary key and the date of each of the records returned into a 2 dimentional array. I then related the array to the callender to get all of the days that had an event on then made them linkable. I then only make another call to the database with the events of the page that was click.<BR>This worked for me because I didn't have alot of records to go through.<BR><BR>The other way that you may want to look at it is to call all of your data into a dataview insted of a datagrid. These are built for moving through and may be easier for you to relate the infomation back to the callender. I find that the datagrid's best feature is for displaying information and not for manipulating it. Some thing to remember is that sorting through a dataview can cause the page to lag.