CodeSmith Community
Your Code. Your Way. Faster!

Filter datasource

Latest post 06-09-2008 4:57 PM by Zlax. 4 replies.
  • 06-09-2008 9:10 AM

    • Zlax
    • Not Ranked
    • Joined on 10-28-2007
    • Posts 4
    • Points 80

    Filter datasource

    Hi i have database with these tables

    User { IdUser, Name , Surename, Username, Password }

    ProfesorData { IdUser, JMBG }

    AdministratorData { IdUser, JMBG }

     

    In form for administering profesors i have made fields required to insert new User and ProfesorData.

    Now problem is how to display a list of all Profesors ( Users which id is found in ProfesorData table ).

    I have tried deeploading User datasource so i could bound the JMBG field 

    but there are still users which are not profesors.  Heres the code i used ( Korisnik == User , ProfesorPodaci == ProfesorData  )

        <data:KorisnikDataSource ID="dsSviProfesori" runat="server" SelectMethod="GetAll" EnableDeepLoad="True">
        <DeepLoadProperties>
                <Types>
                    <data:KorisnikProperty Name="ProfesorPodaci" />
                </Types>
            </DeepLoadProperties>
        </data:KorisnikDataSource>
     
     
        <asp:DataList id="DataList1" runat="server" DataSourceID="dsSviProfesori">
            <ItemTemplate>
                <asp:Label ID="lbListaProfesoraIme" runat="server" Text='<%# Eval( "Ime" ) %>' />
                <asp:Label ID="lbListaProfesoraPrezime" runat="server" Text='<%# Eval( "Prezime" ) %>' />
                <asp:Label ID="lbListaProfesoraJMBG" runat="server" Text='<%# Eval( "ProfesorPodaci.JMBG" ) %>' />
                <asp:Button ID="btnListaProfesoraOdaberi" runat="Server" Text="Odaberi" CommandName="select" /> 
            </ItemTemplate>
        </asp:DataList>

     Also i have tried various filters in data source but I couldn't find what I need. The reason why am I making this list is to be able to select a profesor here and edit his information in some FormView i will later add below this data list. Is this possible without writing code behind.

    Thanks a lot,
    Zlax 

    • Post Points: 35
  • 06-09-2008 9:55 AM In reply to

    • Rippo
    • Top 75 Contributor
    • Joined on 05-06-2005
    • UK
    • Posts 61
    • Points 1,455

    Re: Filter datasource

    Reply |Contact |Answer

    One way would be to create a database view of the related tables then use this as the datasource. This way you could do away with deepload altogether. Views along with tables have web ui datasources.

     

     

    Richard Wilde wildesoft.net

    • Post Points: 5
  • 06-09-2008 1:21 PM In reply to

    • Zlax
    • Not Ranked
    • Joined on 10-28-2007
    • Posts 4
    • Points 80

    Re: Filter datasource

    Reply |Contact |Answer

     Is there other way than to add views to database and regenerate ntiers? I got bored of regenerating project for every change in db.

    • Post Points: 35
  • 06-09-2008 3:06 PM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 416
    • Points 7,635

    Re: Filter datasource

    Reply |Contact |Answer

    Not to my knowledge. You will still need to regenerate Sad

    -Blake

    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: 35
  • 06-09-2008 4:57 PM In reply to

    • Zlax
    • Not Ranked
    • Joined on 10-28-2007
    • Posts 4
    • Points 80

    Re: Filter datasource

     Ah I can't belive that nettiers can't make a simple filter in data source where information is already deep loaded. I have tried deep loading in the code, and User that dont have AdminData has its member ( AdminData ) null. So isn't there a way to filter data source on property after deep loading like Filter="AdminData == null" or something like that?

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