ASP .net calendar control and databases

Results 1 to 2 of 2

Thread: ASP .net calendar control and databases

  1. #1
    Join Date
    Dec 1969

    Default ASP .net calendar control and databases

    This is a theory question I suppose. Not even sure this is the right area, but anyway... <BR><BR>I&#039;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&#039;t figure out a way to have the dataset keyed off the calendar, which in the flow of things, hadn&#039;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&#039;t figure out how to do it. <BR><BR>I&#039;m curious what some of the gurus think about this and if anyone know of a solution using the calendar control that doesn&#039;t require the 42 database calls. Or maybe I&#039;m just out in left field...that happens. <BR><BR>Anyway, thanks for you input and any assistance you can provide.

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP .net calendar control and databases

    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&#039;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&#039;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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts