About The Author
Michael Flynn is a Web Developer at Terralever, an interactive marketing agency based in Tempe, AZ. He specializes in web technologies that include C# .NET, SQL, XML, AJAX, jQuery, Flash, and also skills in Photoshop and Illustrator. He was been involved in web development since 1998, and earned a Bachelors and Masters degree in Computer Engineering and Computer Science from the Univerisity of Louisville and holds an MSCT certificate in Web Applications.
Calendar
<<  September 2010  >>
SMTWTFS
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

Microformats .NET Toolkit - hCard, hCalendar and XFN

I recently got fascinated by Microformats.  Not sure why but its a neat concept that is catching on as Microsoft and Google are taking notice.  I recently wanted to create an easy way to render the most common Microformats, the hCard and hCalendar.  There are so many properties that one can assign it would be very hard to remember what goes where, misspelling, or even an existing property you didn't know existed.  Microformats are adding additions all the time so this would be perfect for someone who didn't want to memorize and check the Microformats website periodically for them. Below is the rendering of three controls I created for this toolkit.

 

hCalendar

Terralever Office Upgrade Bash!
5/7/2009
Tempe Arizona
http://www.terralever.com
Come check out Terralever's new digs and help us celebrate our growth as we officially unveil our new location!

hCard

N 48° 81.6667 E 2° 36.6667
home: 555-555-5555
work: 444-444-4444
Microsoft Outlook
Terralever
dom
425 S. Mill Avenue
Suite 201
Tempe AZ 85281
US

XFN

Terralever

 The control structure is also below.  I have seen some controls developers had made, and they do the job but they are not scalable.  I wanted to create a control that was scalable, and shared common properties. Below is the hCalendar, hCard, and XFN control.  You can read about all these on the Microformats website.

hCalendar

<mf:hCalendar runat="server" ID="hCalendar">
        <Properties>
            <mf:Summary Value="Terralever Office Upgrade Bash!" />
            <mf:DateCollection>
                <Dates>
                    <mf:StartDate DateTime="5/7/2009" />
                </Dates>
            </mf:DateCollection>
            <mf:Location Value="Tempe Arizona" />
            <mf:Url Value="http://www.terralever.com" />
            <mf:Description Value="Come check out Terralever's new digs and help us celebrate our growth as we officially unveil our new location!" />
        </Properties>
    </mf:hCalendar>

hCard

 <mf:hCard ID="hCard" runat="server">
        <Properties>
            <mf:CardGeo>
                <Coordinates>
                    <mf:Latitude Text="N 48° 81.6667" Value="48.816667" />
                    <mf:Longitude Text="E 2° 36.6667" Value="2.366667" />
                </Coordinates>
            </mf:CardGeo>
            <mf:NameCollection>
                <Names>
                    <mf:Name PreferredName="true" Url="http://www.terralever.com" HtmlTag="Div">
                        <NamePropertyCollection>
                            <mf:NameProperty Type="HonorificPrefix" Value="Mr." />
                            <mf:NameProperty Type="GivenName" Value="Michael" />
                            <mf:NameProperty Type="AdditionalName" Value="Saul" />
                            <mf:NameProperty Type="FamilyName" Value="Flynn" SortString="true" />
                            <mf:NameProperty Type="HonorificSuffix" Value="Jr." />
                        </NamePropertyCollection>
                    </mf:Name>
                </Names>
            </mf:NameCollection>
            <mf:TeleCommunicationCollection>
                <TeleCommunications>
                    <mf:Telephone Type="Home" Value="555-555-5555" Preferred="true" />
                    <mf:Telephone Type="Work" Value="444-444-4444" />
                    <mf:Email Type="Internet" Value="mikef@terralever.com" Preferred="true" />
                    <mf:Mailer Value="Microsoft Outlook" />
                </TeleCommunications>
            </mf:TeleCommunicationCollection>
            <mf:CompanyCollection List="true">
                <Companies>
                    <mf:Company PreferredName="false" Name="Terralever" HtmlTag="Div" Url="http://www.terralever.com">
                        <AddressCollection>
                            <Addresses>
                                <mf:Address Type="Domestic" StateCode="true" CountryCode="true">
                                    <AddressContainerCollection>
                                        <mf:AddressContainer>
                                            <AddressPropertyCollection>
                                                <mf:AddressProperty Type="StreetAddress" Value="425 S. Mill Avenue" HtmlTag="Div" />
                                                <mf:AddressProperty Type="ExtendedAddress" Value="Suite 201" HtmlTag="Div" />
                                            </AddressPropertyCollection>
                                        </mf:AddressContainer>
                                        <mf:AddressContainer HtmlTag="Div">
                                            <AddressPropertyCollection>
                                                <mf:AddressProperty Type="Locality" Value="Tempe" HtmlTag="Span" />
                                                <mf:AddressProperty Type="Region" Value="Arizona" HtmlTag="Span" />
                                                <mf:AddressProperty Type="PostalCode" Value="85281" HtmlTag="Span" />
                                            </AddressPropertyCollection>
                                        </mf:AddressContainer>
                                        <mf:AddressContainer>
                                            <AddressPropertyCollection>
                                                <mf:AddressProperty Type="CountryName" Value="United States" HtmlTag="Div" />
                                            </AddressPropertyCollection>
                                        </mf:AddressContainer>
                                    </AddressContainerCollection>
                                </mf:Address>
                            </Addresses>
                        </AddressCollection>
                    </mf:Company>
                </Companies>
            </mf:CompanyCollection>
            <mf:MessagingCollection>
                <Messaging>
                    <mf:IMPP Type="AIM" InstantMessageName="cblaze22@gmail.com" />
                    <mf:IMPP Type="MSN" InstantMessageName="mikef@terralever.com" />
                </Messaging>
            </mf:MessagingCollection>
        </Propert

XFN

<mf:XFNLink ID="xfn" runat="server" Text="Terralever" NavigateUrl="http://www.terralever.com">
        <XFN Family="Parent"></XFN>
    </mf:XFNLink>

 

You can download the toolkit below

Microformats.NET.zip (157.63 kb)

Posted on 7/13/2009 4:28:00 PM by cblaze22

Permalink | Comments (4) | Post RSSRSS comment feed |

Categories: ASP.NET | Server Controls | Microformats

Tags:

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5