Archives / 2003 / November
  • XHTML and Accessibility in ASP.NET Whidbey

    Folks on my team setup a good set of reviews for me last Friday to go over our final plans on Accessibility and XHTML compliance for ASP.NET Whidbey.  I left the meetings feeling really good about where we'll end up when Whidbey ships.

  • Performance Tuning and ASP.NET Whidbey

    We are now in the final mini-milestone of Whidbey feature development -- which is the time when we start to really push hard on performance, even if it means cutting features to hit the necessary performance goals (which is one of the hardest things to go through when shipping a product -- and thankfully one that we haven't had to-do yet with Whidbey).

  • Legomation and Stop Motion Videos built with Web Cams

    I read an article in the November edition of Wired magazine on how you can build stop-motion animation films using Legos and fairly cheap Web Cams (many of which -- including the Logitech Quickcam -- come with built-in stop motion animation software). 

  • My PDC Keynote Demo

    I was forwarded a few pictures from my PDC keynote demo today.  Keynote demos are always “fun” events, and are great at creating a lot of stress in a compressed period of time.

  • Fun ASP.NET Whidbey Tip/Trick: DataBinding to Generics

    One of the great new features in Whidbey are "Generics" -- which basically provide a mechanism that enables developers to build classes whose signature and internal datatypes can be templatized.

    For example, rather than use an ArrayList (which is a collection of type Object), or force developers to create their own strongly typed list collection class (ie: the OrderCollection class) -- developers using Whidbey can use the new List class implemented within the System.Collections.Generic namespace, and specifically specify the type of the collection when using or referencing it.

    For example:

    // Use the built-in "List" collection within the System.Collections.Generic namespace
    // to create a collection of type "Order"

    List<Order> orders = new List<Order>();

    // Add Order objects into the list

    orders.Add(new Order(123, "Dell"));
    orders.Add(new Order(345, "Toshiba"));
    orders.Add(new Order(567, "Compaq"));

    // Lookup the "OrderId" of the first item in the list -- note that there is no cast below,
    // because the collection items are each an "Order" object (as opposed to "Object"
    // which they would be with an ArrayList

    int orderId = orders[0].OrderId

    // The below statement will generate a compile error, but would have
    // compiled (but generated a runtime exception) if the collection was
    // an ArrayList

    orders.Add("This will not work because it isn't an order object");


    Below is a more complete sample on how to use Generics with the new ASP.NET ASP:ObjectDataSource control, and then bind the list to a GridView control.

    First is the "OrderSystem.cs" file which should be saved within the "Code" directory immediately underneath the application vroot:

    // OrderSystem.cs: Save within "code" directory
    using System; using System.Collections.Generic;

    public class Order { private int _orderId; private string _productName;
    public Order(int orderId, string productName) { _orderId = orderId; _productName = productName; }
    public string ProductName { get { return _productName; } }
    public int OrderId { get { return _orderId; } } }
    public class OrderSystem { public List<Order> GetOrders() { List<Order> orders = new List<Order>();
    orders.Add(new Order(123, "Dell")); orders.Add(new Order(345, "Toshiba")); orders.Add(new Order(567, "Compaq"));
    return orders; } }
    I can then write a simple .aspx page that uses the ObjectDataSource control to bind against the "GetOrders" method to retrieve a List of Order objects. I can then point the GridView at the ObjectDataSource control:

    <%@ page language="C#" %>
    <html> <body> <form runat="server"> <asp:gridview id="GridView1" runat="server" datasourceid="ObjectDataSource1" bordercolor="#CC9966" borderstyle="None" borderwidth="1px" backcolor="White" cellpadding="4"> <headerstyle forecolor="#FFFFCC" backcolor="#990000" font-italic="False" font-bold="True"> </headerstyle> </asp:gridview>
    <asp:objectdatasource id="ObjectDataSource1" runat="server" typename="OrderSystem" selectmethod="GetOrders"> </asp:objectdatasource>
    </form> </body> </html>

  • The PDC was a Blast...

    I just returned to Seattle from the PDC in LA (I ended up staying an extra day to present to the local .NET User Group on Whidbey Thursday night).