in

CodeSmith Community

Your Code. Your Way. Faster!

OrderByClause

Last post 06-13-2007 7:34 AM by Tanno. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-15-2007 8:27 AM

    • zeus
    • Top 150 Contributor
    • Joined on 05-10-2006
    • Posts 25
    • Points 330

    OrderByClause

    Hello:  Okay, I've done quite a bit of searching for this, but to no avail.  Item in question is the 'OrderByClause' used with typed datasources as an input parameter.  The obvious use is and 'order by' clause for a stored proc parameter.  The unobvious is what the 'OrderByClause' traces back to.  I've found that the 'OrderByClause' is an alias in the EntityDataSource and as a dictionary indexer in the CustomDataSource, but that's it.  For the typed datasource, I cannot find how/where the 'OrderByClause' is used; however, I do see where the DataSourceSelectArguments propeties are assigned to the various BaseDataSource parameters including OrderBy (from SortExpression) in BaseDataSource.  So, my confusion is with where is the 'OrderByClause' parameter used and is it actually necessary?  Any clarification and/or insight would be greatly appreciated.  Thanks...

    • Post Points: 35
  • 04-18-2007 5:52 AM In reply to

    • zeus
    • Top 150 Contributor
    • Joined on 05-10-2006
    • Posts 25
    • Points 330

    Re: OrderByClause

    I'm new to nettiers and I was hoping for a little community support.  Someone throw me a bone.  Thanks...
    • Post Points: 5
  • 06-13-2007 7:34 AM In reply to

    • Tanno
    • Top 100 Contributor
    • Joined on 10-06-2006
    • Posts 50
    • Points 1,185

    Re: OrderByClause

    In case you want to order the datalist of a typed datasource you can use the Sort property instead of an OrderByClause.

     Example:   Let's say you want to populate a Radiobutton list with the typed dataSource

    <asp:RadioButtonList ID="rblMarket" runat="server"

    RepeatDirection="Vertical" RepeatColumns="1"

    DataTextField="LotTypeName" DataValueField="LotTypeID" >

    </asp:RadioButtonList>

    <data:LotTypeDataSource ID="LotTypeDataSource1" runat="server" SelectMethod="GetAll">

    </data:LotTypeDataSource>

    You need then the following code in your PageLoad code behind

    rblMarket.DataSourceID = "LotTypeDataSource1";

    LotTypeDataSource1.Sort = "LotTypeID";

    rblMarket.DataBind();

    Hope this helps

    Tanno 

     

    Filed under:
    • Post Points: 5
Page 1 of 1 (3 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems