Wednesday, December 14, 2005 3:08:04 PM UTC :: Filed Under Web Design

After dabbling with XHTML and extensive CSS a few months ago, I finally ‘saw the light’ as to why some web designers make such extensive use of CSS and DIV tags over traditional HTML and tables.  However, for as many cool things you can do with CSS and DIV tags, there are drawbacks… like trying to make a simple 2 or 3 column web page ;-S

On the surface, it seems like an easy task to create a multi-column CSS layout, but the problem sets-in when you try to view your site in different browsers.  At the moment, it seems like no two browsers will display content the same even though many of them are trying to adhere to the W3C’s standards. As a result, most of the multi-column designs I’ve seen have all sorts of “CSS hacks” to fudge the layout in various browsers.

Anyway, to aid in creating a multi-column CSS design, give this template generator a try:

CSS Source Ordered Variable Border 1-3 Columned Page Maker

Using the generator is a little easier than trying to reverse engineer someone else’s design that doesn’t quite fit what you want to do.

Wednesday, December 14, 2005 2:53:37 PM UTC :: Filed Under ASP.NET

Seems that most programmers are not good designers, and most designers are not good programmers.  However, Microsoft is making it easier for programmers to not worry so much about design by providing a set of new templates for VisualStudio.NET 2005.

The interesting part is that these templates are not only pretty nice looking, some of them conform to the XHTML 1.1 Strict standard; that’s something you couldn’t even dream of doing with VisualStudio.NET 2003!

In addition to being standards compliant, these templates make use of Master Pages, Themes, and Skins, so they should serve as good references on how to properly use these new features in VS.NET 2005.

MSDN: Design Templates

Wednesday, December 14, 2005 2:45:59 PM UTC :: Filed Under Photography

Converting a color photo to black and white is pretty easy, but going the other way is not… until now!  Recolored.com has a free beta download that allows just about anyone to colorize their black and white photos:

http://www.recolored.com/

Thursday, December 08, 2005 5:17:30 PM UTC :: Filed Under ASP.NET

What? You don’t have any Microsoft certifications and you feel lonely?  Not to worry, Jason Mauss has created some new Microsoft MVP awards that you can add to your web site so that you’ll fit-in better ;-)

            
  
            

Tuesday, December 06, 2005 6:48:13 PM UTC :: Filed Under ASP.NET | Web Design

I like adding help messages to web forms, but I find that these help messages can often make the page very long.  Since a user won’t like need a help message once he has read it, it’s nice to be able to hide the message.

With that in-mind, the JavaScripts below are nice samples of scripts that will display or hide content that is within a specified <DIV> tag.  They can be called from a single button or hyperlink:

function toggleDiv(divName) {
    thisDiv = document.getElementById(divName);
    if (thisDiv) {
        if (thisDiv.style.display == "none") {
            thisDiv.style.display = "block";
        }
        else {
            thisDiv.style.display = "none";
        }
    }
    else {
        alert("Error: Could not locate div with id: " + divName);
    }
}

function toggleDiv(divName) {
    var thisDiv = document.getElementById(divName);
    if (thisDiv) thisDiv.style.display = !thisDiv.offsetWidth ? "block" :"none";
    else alert("Error: Could not locate div with id: " + divName);
}

Tuesday, November 29, 2005 10:33:12 PM UTC :: Filed Under ASP.NET | VB.NET

I recently took on the project of trying to create my own Business Logic Layer (BLL) and Data Access Layer (DAL) in a personal web project so I could understand how the various layers of n-tier architecture are supposed to work.  I didn’t get very far before I realized that allowing NULL database values (System.DBNull.Value) in various fields in my database was going to give me a large headache :'(

After doing a lot of research, I didn’t come-up with too many satisfactory methods for dealing with DBNulls.  At best, it seemed like I’d have to write all sorts of methods for converting DBNulls to either a default value for each data type (I.e., define an integer to default to zero, a string defaults to String.Empty, a date defaults to DateTime.MinValue, etc.) or use the new VB.NET 2.0 Nullable Types and set each data type to Nothing.  This sounded like a lot of work and a lot of code… more code = more errors!

I read a few articles on using Generic Types in VB.NET 2.0 and it appeared to me as though they could be the answer to my prayers:  Create one generic method that can check for DBNulls for all data types.  A blog post by Saravana Kumar shows a way to accomplish this using C#. However, C# has a keyword default which doesn’t exist in VB.NET (at least not that I could find.)  This keyword apparently returns the default value for each data type, just like I wanted!

After much tinkering, here is what I came-up after trying to convert Saravana’s code to VB.NET:

Public Shared Function ConvertDBNull(Of T)(ByVal obj As Object) As T
    If (obj Is System.DBNull.Value) Then
        obj = Nothing
    End If
    Return CType(obj, T)
End Function

So far, it seems to work!  For example, with the following code:

Dim oSomeTestObject As Object = System.DBNull.Value
Dim strResult As String = ConvertDBNull(Of Integer)(oSomeTestObject)

The value of strResult is returned as a zero.  Another example:

Dim oSomeTestObject As Object = System.DBNull.Value
Dim strResult As String = ConvertDBNull(Of Date)(oSomeTestObject)

The value of strResult is returned as a “12:00:00 AM”. For most dates that I display, I always format them as MM/dd/yyyy, so a date value only exposing time won't show.

I tested this new method on my BLL, and so far it works great! w00t! If you have a better method for dealing with DBNulls in your Business Logic, let me know… I’m all ears!

Navigation
On this page....
Search
Archives
<December 2005>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Categories
Contact me
Send mail to the author(s) Contact Todd M. Taylor