CodeSmith Community
Your Code. Your Way. Faster!

How to join two tables using a datasouce tag

Latest post 04-11-2008 12:54 PM by blake05. 1 replies.
  • 04-04-2008 12:08 AM

    How to join two tables using a datasouce tag

    Hello,

    I have two tables (List and ListType). Primary(ID) key of "List" table is the foreign key of "ListType". I would like to join the two tables and retrieve values on modifying the below code.

    <data:ListDataSource ID="LibraryCategoryDataSource" runat="server" SelectMethod="GetPaged">

    <Parameters>

    <data:CustomParameter Name="WhereClause" Value="hasRow = 1" /> </Parameters>

    </data:ListDataSource>

    • Post Points: 35
  • 04-11-2008 12:54 PM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 351
    • Points 6,205

    Re: How to join two tables using a datasouce tag

    Hello,

    I think deep loading is what you are looking for via (DeepLoadProperties) e.g. (http://docs.nettiers.com/FrequentlyAskedQuestions.ashx #2 and #3). The below should help give you an idea.


    <data:ListDataSource ID="MainListDataSource" runat="server" SelectMethod="GetPaged"  EnableDeepLoad="true" EnablePaging="true">
        <DeepLoadProperties>
            <Types>
    <data:ListProperty Name="ListType" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:CustomParameter Name="OrderBy" DefaultValue="Type" />
            <data:SqlParameter Name="WhereClause" UseParameterizedFilters="false">
    <Filters>
        <data:ListFilter Column="Type" ComparisionType="Contains" DefaultValue="1" />
    </Filters>
            </data:SqlParameter>
        </Parameters>
    </data:ListDataSource>

    Thanks

    -Blake Niemyjski

    Blake Niemyjski

    CodeSmith Tools, LLC Support Specialist

    Blog: http://windowscoding.com/blogs/blake/

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

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