CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Steve Hebert's Development Blog

Steve's Blog - From .Net to dotMath and everything in between.

February 2007 - Posts

  • XP Media Center lost my second core (once again)

    In the last 12 hours, Windows XP Media Center lost my second core again. I blogged about this a while back where suddenly my dual-core system was only utilizing a single core - apparent in task manager, device manager and general performance.  Even with 3GB of RAM, this sent things crawling in Virtual PC.

    I'm guessing that some patch was dispatched today (Sunday) and the system stopped recognizing the second core.  I wonder if anyone from MS and/or AMD is watching.  I reran the driver that I linked to in my blog entry and all was restored. That's annoying.

    I wonder how many dual core users are running 3 cans short of a 6 pack without noticing.

  • Hiearchical data binding with CSLA and Telerik's radGrid control.

    Following on the CSLA databinding theme, I ran into an interesting problem on databinding a parent/child CSLA business object relationship with Telerik's radGrid control. The solution is certainly not obvious, but the implementation ends up being pretty straight forward.

    First, I set up two distinct CslaDataSource controls - one for each collection.  In reality, these are part of the same object hiearchy and I could do this with one control, but I feel it comes out a little cleaner with two.

    The key points to consider are this:

    1. Grid: Set the MasterTableView and DetailTable DataSourceIds to their respective CSLA data binding control (dbc).
    2. Grid: Set the MasterTableView's DateKeyNames property to reflect the unique identifier for the parent row.
    3. DBC Parent: Set up the DataSource_SelectObject to return the business object via the e.BusinessObject parameter.
    4. Grid: Map the ItemCommandEvent to grab parent key using the code snippet below.
    5. DBC Child: Set up the DataSource_SelectObject to return the appropriate child object according to the key obtained in step #4.

    Below is the code snippet for the Grid_ItemCommand event mentioned above:

    private Guid ActiveParentId = Guid.Empty;  //data type may vary for actual implementation.

    protected void ..._ItemCommand(...)
    {
       if( e.CommandName == ExpandCollapseCommand )
          ActiveParentId = (Guid) e.Item.OwnerTableView.DataKeyValues[e.Item.Index][parentIdName];
    }

  • Setting up CSLA databinding on a webpage using an @Register tag

    Setting up databinding using a custom datasource within a page is not always obvious.  I'm putting this on my blog as I know I'll be referring back to it.

    CSLA is available on Rocky Lhotka's site with downloads, forums and latest version info.

    Because databinding is provided through the generic CslaDataSource object in the CSLA framework, there's a bit of indirection going on in the setup.  Rocky's sample code in ProjectTracker defines the page level references in the web.config file, but I'd rather explicity define them on the page for now.

    First, register the Csla assembly in the @ Register tag at the top of your aspx file with:

     <%@ Register Assembly="Csla" Namespace="Csla.Web" TagPrefix="csla"  %>

    This allows for a reference to the datasource provider in the framework.

    Next, define the actual datasource object on your page that references your business object/collection using the following:

     <csla:CslaDataSource ID="MyDataSource" runat="server" 
         TypeName="[Company.Product.Layer.Class]" 
         TypeAssemblyName="[Assembly Name that implements TypeName]"
         TypeSupportsPaging="False"
         TypeSupportsSorting="False" >
    </csla:CslaDataSource> 

    You'll need to wire up the OnSelect and other handlers, but Rocky's book provides excellent examples of this.

More Posts