Friday, February 27, 2009

ASP.NET MVC and Tabs

Recently I have been spending time creating a batch application for SQL Server Reporting Services. During the day, I work for a third-party administrator (TPA). Part of the business involves the payment of medical, vision and dental claims on the behalf of our clients. Periodically we need to print the check registers on the accounts from which the claims payments are made. A data driven subscription alone is not flexible enough. Running the report on demand for each date and client would take too long.

To make it easy for the accounting department to run these reports, I created a web application using ASP.NET MVC that allows the user to search for check runs by date and then select which registers to print from the search results. The selection is used to populate a parameter table followed by the application executing a SQL Agent job associated with a standard data driven subscription for the check register report. Now that the background is out of the way, on to the problem and solution.

The default ASP.NET MVC application layout is a simple master page with a "MainContent" place holder. The master page provides a menu located above the content place holder. The menu is a basic unordered list formatted to look like a series of tabs. Each tab contains an ActionLink helper that ties it to a specific controller and action. This works great except that there is no support for identifying and maintaining the currently selected tab.