asp.net calendar is too slow on OnDayRender

I have a calendar in my asp.net application. OnDayRender I need to bind a value for each specific day from the database. So, I establish a connection to the db for each day. And, this slows down the system a lot. What would be a better way of doing this? How can I get these data for all month at once and display it appropriately?

Thanks!

Jon Skeet
people
quotationmark

Instead of doing the database query in OnDayRender, do it when your form initially loads, and fetch the data for the whole month (or whatever the range of the calendar is) into a List or something similar. Then your OnDayRender code can just fetch the data from the list.

It's hard to say more than that without a better idea of what you're doing, but that's the gist of it: fetch all the relevant data from the database into memory at the start, and then grab individual days from memory when you need them.

people

See more on this question at Stackoverflow