Journal Iamthefallen's Journal: Lost in .Net 1
Right now I'm developing a reporting web application to be used primarily by our external users. In the process I'm also refactoring some old code to try to establish a more solid platform for future applications, the whole re-usability thing that's so popular these days.
One of the things I've found in working with
This morning I wanted to create a fairly simple thing, have a base page that other pages inherit from that can provide common functionality, error handling etc. For instance, I want the ability to show a message at the top of each page indicating he outcome of an operation. So I add a ShowMessage method to my base class.
OK, all is fine and dandy.
But, I also want to use ASP.Net master pages for the visual layout, how to accomplish this along with the base page turned out to be not as simple as it would appear. Looking through forums and articles people have come up with a multitude of "clever" ways to do similar things, and the more clever, the more lines of code. So testing the various methods, finding out that there was "just this one little thing" that the developer hadn't solved "just yet".... Various approaches of overriding render methods, assigning master pages at runtime, creating custom content templates, and all kinds of other crazy things.
Finally I thought, "There's got to be a better way to do this".
Which means, there usually is.
The simple solution was the create an Interface with a Showmessage method.
Have the Masterpage implement this interface.
Have the base page test the type of the master page it belongs to, and if the interface is implemented, call ShowMessage in the master page.
Simple, elegant, and very not-clever.
I don't like clever. Too damn many
frameworks, complexity, bloat, oh my! (Score:1)
It's my crusty old perception that the Java and