I've databound the Gridview to my ObjectDatasource this is populated through my entity manager class which returns a sorted entitycollection.
<asp:ObjectDataSource ID="SkillDataSource" runat="server" SelectMethod="getSkillsByProfessionID"
TypeName="NickEales.BuildBot.BL.SkillManager" SortParameterName="sorterString">
<SelectParameters>
<asp:ControlParameter ControlID="ProfessionDropDown" Name="selectedProfessionID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:GridView ID="SkillGrid" runat="server" Width="100%" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SkillDataSource" CellPadding="2" ForeColor="Black" GridLines="None" BackColor="LightGoldenrodYellow">
<asp:TemplateField ShowHeader="False" SortExpression="CastTime" HeaderText="Cast">
<ItemTemplate>
<asp:Label Text='<%# Eval("CastTime") %>' runat="server" /> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/icons/casttime.gif" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
The sort expression is passed through to the manager object where it sorts the entity collection through the Sort(SortExpression, Direction, Compare) method. How exactly do I get the direction from the sort expression as the only thing which is passed through this string is the field to sort on.
I'd prefer not to do any kind of eventhandling just yet as I'm doing this project as a testcase to see how much can actually be done at design-time with LLBLgen and the VS.Net 2005.