Custom Web Controls for ASP.NET Apps
Custom web controls for your ASP.NET application are a brilliant way to separate, reuse and “refactor” your code pieces. In that sense I consider myself to be a control freak and that’s a good thing!
In our product Headlight we use a lot of create flows (here’s an example) that are built using tables with 3 columns. The two first are somewhat static text and the third can be any kind of HTML and ASP.NET controls.
It’s a pretty standard way of building create flows and it works even better with custom controls. This is the code used to create the table above:
You can also add create flow items programmatically like the following example where a hyperlink is added:
That’s a pretty easy and uniform way of building them and the best part is, that when something is changed, it applies to all the different create flows – and we use a lot of them. Even though it is not the exact implementation we use in Headlight, it is very similar but also simpler.
This is the source code for the CreateFlow and CreateFlowItem. Just put it in the App_Code folder or a custom control assembly if you prefer.
Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.