Archive for July 23rd, 2009

Conditional Order-By clause in SQL 2005

In SQL Server 2005 onwards you can have conditional Order By clauses in your stored proc’s- for example

SELECT EmployeeID, SalariedFlag
FROM HumanResources.Employee
ORDER BY CASE SalariedFlag WHEN 1 THEN EmployeeID END DESC
        ,CASE WHEN SalariedFlag = 0 THEN EmployeeID END;
GO

CASE (Transact-SQL).

No Comments

How To Display Hierarchical Data Using Nested Repeater Controls and Visual C# .NET

Just found a piece of functionality which I’ve never noticed before, for populating nested Repeaters, without doing so in the code behind with a “OnDataBound” Event.

It’s as simple as just setting the DataSource on the child repeater, to a property of the parent repeaters DataItem.  For example;

<asp:Repeater ID="BookRepeater" runat="server" onitemdatabound="bibRepeater_ItemDataBound">
    <HeaderTemplate><ul></HeaderTemplate>
    <ItemTemplate>
      <li>
         <h1><%# DataBinder.Eval(Container.DataItem, "BookTitle")%></h1>
         <asp:Repeater ID="AuthorsRepeater" runat="server" DataSource='<%# ((Book)Container.DataItem).Authors %>'>
         <HeaderTemplate><h5>Author: </HeaderTemplate>
             <ItemTemplate>
                 <a href='/AuthorDetails.aspx?id=<%# DataBinder.Eval(Container.DataItem, "Id")%>' title="<%# DataBinder.Eval(Container.DataItem, "FirstName")%> <%# DataBinder.Eval(Container.DataItem, "LastName")%>"><%# DataBinder.Eval(Container.DataItem, "FirstName")%> <%# DataBinder.Eval(Container.DataItem, "LastName")%></a>
             </ItemTemplate>
             <SeparatorTemplate>, </SeparatorTemplate>
             <FooterTemplate></h5></FooterTemplate>
         </asp:Repeater>
      </li>
    </ItemTemplate>
    <FooterTemplate></ul></FooterTemplate>
</asp:Repeater>

You may need to add a declaration to the namespace in which your entities reside, at the top of your aspx file, like this;

<%@ Import Namespace="Hachette.Entities.Orchard" %>

full details on MSDN; How To Display Hierarchical Data by Using Nested Repeater Controls and Visual C# .NET.

No Comments

I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.