in

CodeSmith Community

Your Code. Your Way. Faster!

Paging DataSets on a webpage using custom stored procedures

Last post 01-27-2008 9:02 AM by mr.msobhy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-10-2006 5:21 AM

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 921
    • Points 34,675

    Paging DataSets on a webpage using custom stored procedures

    OK, so you want to use a dataset returned from a custom stored proc (csp) in web page, but don't want to do any of the paging plumbing yourself.

    Specify your csp such that it will be picked up by NT and returns a dataset i.e. make sure the columns don't match the parent entity. NT will automatically generate the code to handle the paging for you in the data layer.  If you generate the service layer they will also be picked up there to.

    Ok so how do we get it on our web page.  Create an ObjectDataSource in the following manner: 

    <asp:ObjectDataSource runat="server" ID="ods" TypeName="MySystem.Services.ProductService" SelectMethod="GetNoProductSite"  />

    Note the TypeName and SelectMethod point to the service and method you want to execute.

    You can then create an EntityGridView and link to the data source using the datasourceid. Enable paging and away you go! 

    swin

    -------------------------------------------------
    Member of the .NetTiers team
    -------------------------------------------------
    • Post Points: 105
  • 10-19-2006 12:10 PM In reply to

    Re: Paging DataSets on a webpage using custom stored procedures

    Great tip Swin!!

    Robert Hinojosa

    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams

    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 01-30-2007 2:37 AM In reply to

    • skbach
    • Top 75 Contributor
    • Joined on 01-18-2007
    • Vancouver, British Columbia
    • Posts 58
    • Points 1,470

    Re: Paging DataSets on a webpage using custom stored procedures

    Swin/Robert,

    What is meant by "NT will automatically generate the code to handle the paging for you in the data layer."?

    I expected this solution returns ALL results and then pages through them, similarly to the way .NET works without .NETTiers. (using Gridview and Objectdatasource).

    Or does the statement mean that .NETTiers is somehow customizing the paging to avoid this inefficiency?

    Thanks.
     

    Scott Klarenbach
    PointyHat Software
    www.pointyhat.ca
    _______________________________________
    To iterate is human; to recurse, divine
    • Post Points: 5
  • 01-27-2008 9:02 AM In reply to

    • mr.msobhy
    • Not Ranked
    • Joined on 03-31-2007
    • Posts 4
    • Points 80

    Re: Paging DataSets on a webpage using custom stored procedures

    swin:

    OK, so you want to use a dataset returned from a custom stored proc (csp) in web page, but don't want to do any of the paging plumbing yourself.

    Specify your csp such that it will be picked up by NT and returns a dataset i.e. make sure the columns don't match the parent entity. NT will automatically generate the code to handle the paging for you in the data layer.  If you generate the service layer they will also be picked up there to.

    Ok so how do we get it on our web page.  Create an ObjectDataSource in the following manner: 

    <asp:ObjectDataSource runat="server" ID="ods" TypeName="MySystem.Services.ProductService" SelectMethod="GetNoProductSite"  />

    Note the TypeName and SelectMethod point to the service and method you want to execute.

    You can then create an EntityGridView and link to the data source using the datasourceid. Enable paging and away you go! 

    swin

     

     

    mt too want to know the meaning of those words 

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