RealSimpleBlog custom control (V1): Day 1

.NET, ASP.NET 2.0, Technical stuff
See comments
I started writing my RealSimpleBlog control yesterday. The goal is to have V1 up and running by July 12th, which is the date we're flying off to Malaysia for 3 weeks holidays. I plan to integrate the control in my PhotoAlbum, and to blog on that page while I am away. That will provide a nice test for the concept. V1 will be pretty basic, considering I'll have only 3 weeks to implement it. But it will be the basis for future development, and I am pretty excited about it.
Day 1: I started by converting my Web.CustomControls project to .NET V2. This assembly is where I store the custom controls I program for my web pages. For the moment, this assembly contains the Treeview I use in my PhotoAlbum and the About form which is displayed when you click on the "GalaSoft Web Treeview" node, and then on "About". It also contains some helper classes, which help me solve the main problems you have when you develop custom controls: how to get the satellite files to be installed on the web server, and how to register the CSS and JavaScript files on the webpage. These classes (one more thing I should blog about) handle this, and also take care of version check (i.e. make sure that the correct satellite file with the correct version is available on the web server and on the webpage).
The conversion went pretty well, with a few minor details. For example, I had a few syntax errors:
  • In ASP.NET 1.1, I sometimes had pages with a Page directive, mostly when the ASPX page was used only as a container for Custom Controls, but didn't have code-behind. This is now considered as a syntax error in C#. I had to add Page directives in every of my test pages, then close them and reopen them, which eliminated the error. When the page doesn't have code-behind, the syntax is simply
    <%@ Page Language="C#" %>
  • In ASP.NET 1.1, I used to register a tag prefix for my namespace GalaSoftLb.Web.CustomControls (for example "gslb"), and to then refer to sub-namespace with the syntax
    <gslb:RealSimpleBlog.CRealSimpleBlog (...)
    In ASP.NET 2.0, however, this produces an error (though not a compilation error). So now I register one tag prefix for exah sub namespace (for example "gslb_realsimpleblog") and then I use
    <gslb_realsimpleblog:CRealSimpleBlog (...)
  • The HTML code validation is now very strict (I use HTML 4.0 transitional), and I spent a moment correcting these small errors (not critical, but I like my code neat).
  • A few deprecated methods used, thus a few warnings, nothing too bad. I'll handle that after my holidays.
  • Last thing which bugs me (but I didn't find how to solve it): I use a Web Application Project, which allows having files out of the project, but in the same directory structure anyway. This is good, especially if you have source control enabled, because this way you can have big files not into source controls, while HTML and other text-based files in the site, but not under source control. However, Visual Studio generates an error (not a compilation error, though) when a file exists, is under the correct path, but is not included in the project. I'll look for a way to switch that error off, or I'll just ignore it.
So now... let's implement!
Previous entry | Next blog entry

Comments for RealSimpleBlog custom control (V1): Day 1