Events Calendar

by admin 16. June 2007 20:43

One of the most common features of community websites these days is the events calendar. It's also the source of one of my pet hates, the stretching of calendar cells as event title links are added for a particular day. Nothing looks worse than an event calendar with an average of one or two events per day... with that one fifteen-event day stretching the entire Calendar control down the page. This is not just an issue of esthetics. If you only display a limited number of events for a given day, pretty soon the other event organizers will be calling to ask why their events are not being shown! In such situations, a compromise is frequently called for.

Recently, I worked on such an events calendar for my local town's Business Improvement District. The client  wanted an easy way for users to see when there were events without having to dig too much to find them.I did not want to use the Calendar control to display event links. I chose instead to implement a master Calendar highlighting days that had events, and an associated events listing implemented as a pageable GridView.

During development, I encountered the following exception:

ObjectDataSource 'sourceEvents' could not find a non-generic method 'GetEventsByMonth' that has parameters: startDate, endDate, startDate1, endDate1...

This occurred in the paging event handler for the GridView. I was adding the SQL parameters programmatically and implemented a quick fix as shown below:

// Manually remove any select parameters from ParameterCollection sourceEvents.SelectParameters.Remove(sourceEvents.SelectParameters["startDate"]); sourceEvents.SelectParameters.Remove(sourceEvents.SelectParameters["endDate"]);

Then I added the same parameters as before and everything worked fine.

If I ever have to do something similar again and there are a lot of events involved, I might have to look to AJAX for a more creative alternative. Has anyone found another way of doing this? If you would like the complete code, please email me.



Welcome to CodersBarn.com

by agrace 10. June 2007 21:26

Here goes... I guess I've been gleaning the goods from other people's sites long enough! They say committing to a blog is a time-consuming venture. I've decided to get this site out fast and then add to it gradually. The main motivation behind this blog is to create a forum where developers like myself can discuss programming and design issues. I want to encourage beginners and experts alike to make this site a place where people can have fun and learn at the same time. 

I have been reading Mads Kristensen's blog and it is his Blog Engine that is under the hood. I have been using ASP.NET and C# for around three years. I'm no expert but was able to download Mads' Blog Engine this afternoon and have it up and running in no time. I made some minor changes to the theme stylesheet and that was it. The previous night, while browsing through iStockphoto I came across the banner picture you see above. This morning, I took one look at it and the domain name just jumped out at me. Five minutes later, I had it registered on GoDaddy and this baby was born!

This is a really exciting time for Web Developers in general. Hopefully, some of the subjects that interest me personally will be representative of some of the new technologies emerging in our industry as we look forward. Please email me if you have any thoughts about interesting directions this site could possibly take.

I am currently embarking on the Ajax and SharePoint learning curve but ASP.NET 2.0 is still the main focus of my work and future posts will probably reflect that.

Anthony Grace :-)

 

Tags: ,

ASP.NET | C#