It has been a while since I last posted a technical post. I’m sorry, but I am too busy enjoying my work to keep you posted as much as I should.
Just a few days ago I was playing around with YSlow and PageSpeed, two add-ons on Firefox. Both stated my Javascript files were 1) to many and 2) not at all at minimum size.
Searching for an automated way of cleaning up and minifying my Javascript files, I bumped in on JSMin, a Javascript minifier that can be downloaded in C#. Do you hear the term HttpModule in your head already as I did?
When you try to implement JSMin, do consider the fact that your Javascript files will be stripped really rigorous: some of my files did not work anymore after minifying. The reason for this is that Javascript gives you the opportunity to write bad code. To prevent myself from writing rubbish Javascript files that fall apart using JSMin, I now use ‘the tool that hurts feelings’, JSLint. It hints you about bad code and, when obliged to, prevents you from failure when using JSMin afterwards
…
Lucky coding
!
Once in a while I have to develop custom user controls that require blank rules in them. Almost always I think again: ‘I should have blogged about it, would have saved me lots of time searching’
… Well, no more, because here it is…
Many people using blank rules in C# code, use the following commands:
var brControl1 = new HtmlGenericControl { InnerHtml = "<br />" };
var brControl2 = new HtmlGenericControl("br");
However, brControl1 also prints a <span> tag and brControl2 prints <br></br>. Both options are not really useful. You should take notice of the fact that the HtmlGenericControl is not meant to be used for anything else than span, body, div and font (what is designed for ‘as the word goes’). The way to go when printing a blank rule is:
var brControl3 = new LiteralControl("<br />");
This actually prints exactly what you would like it to print, namely <br />. Hope this helps you too
! BTW, if you are using the HtmlTextWriter class, you can also use the WriteBreak() function if you like.
This morning I ran into a ASP.NET bug in Visual Studio. Dragging a custom server control on an aspx file was not possible since I had ‘an invalid FORMATETC structure’ (what the …. is that?!). The message box alerting me something is really really wrong is this one:

Trying to solve the bug, I found the following attribute to be the problem: [ToolboxItem(true)]. Just delete the attribute, rebuild the application and the problem/bug disappears!
Good luck! Happy coding!
Yesterday I had troubles to get an ASP.NET control to work with rounded corners in various browsers. IE and Firefox operate slightly different from each other, and to get it working (using ASP.NET themes) was quite a pain in the ass. Besides, it is not cool to have the obligation to change 4 images per control every time the design team has the bright idea to change website colors for some very good reason.
Luckily, at the end of the day, I discovered DD_roundies, a Javascript library perfectly taking care of my needs. Only in Opera this functionality does not function as wanted (no rounded corners), but that’s an issue Drew Diller is trying to address, according to his website. I definitely would suggest you to try for yourself if you would like an acceptable solution to the problem described hereabove.
The only thing that does not currently stop bothering me: unfortunately it is (still) not possible to have some javascript in an ASP.NET theme. Would that be possible, the solution would be perfect (for me). Perhaps somebody found a solution for me
?
Since a couple of months I moved my hosting packages to a new host, DIGITALiBiz. The reason I moved in to them is their incredible low pricing considering what they offer. I currently have ASP.NET 3.5 hosting, 350GB disk space and 5 SQL Server 2005 databases of 250MB each. Who can beat them???
After some months of working with DIGITALiBiz, I can say that they have an excellent support team and a very reasonable performance. Definitely recommended!
Curious? Have a look at DIGITALiBiz.
Technorati tags: asp.net cheap hosting hosting