CodeSmith Community
Your Code. Your Way. Faster!

EntityDataSource and Custom Stored Procedure Usage For GridView

Latest post 10-10-2006 3:48 PM by rob_nettiers. 2 replies.
  • 10-09-2006 3:59 PM

    Huh? [:^)] EntityDataSource and Custom Stored Procedure Usage For GridView

     First of all let me say I not using the most currently release version, but I using the most current previous as you can hopefully see in my example that has allowed me to use EntityDataSource. I searched high and low here, but was not able to see example using EntityDataSource for Gridview using Custom View or Procedure?

     I created my stored procedure _Orders_SelectWithNull and included in codesmith. This is all working great and can see available in my intellisense in my code behind:

    DataRepository.OrdersProvider.SelectWithNull(int opt1, int opt2, int op3)

     I verified everything working with just using OrdersProvider, How do I reference the custom method I just added on the OrdersProvider and also send it the storeprocedure/method parameters it's expecting

    How do you reference custom provider entity? Hmm

     <data:EntityDataSource ID="OrdersDataSource" runat="server"
    ProviderName="OrdersProvider"
    EntityTypeName="exampleDB.BLL.OrdersProvider, exampleDB.BLL"
    SelectMethod="GetPaged"
    EnablePaging="True"
    EnableSorting="True">

    Once referenced? use?

    <data:DataParameter

    data:DataParameter

    <data:DataParameter

    data:DataParameter

    <data:DataParameter

    data:DataParameter

    <data:DataParameter

    data:DataParameter

    <data:DataParameter

    ------------------- rob_nettiers -------------------
    • Post Points: 50
  • 10-10-2006 11:25 AM In reply to

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

    Re: EntityDataSource and Custom Stored Procedure Usage For GridView

    If your csp is returning a dataset have a look at my tip here http://community.codesmithtools.com/forums/thread/18699.aspx 

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 10-10-2006 3:48 PM In reply to

    Re: EntityDataSource and Custom Stored Procedure Usage For GridView

    That tip is great, thanks. Here is what I ended up doing before reading your post. Hope it helps the next person. You are correct, the automatic paging and sorting with gridview only work with a sqldatasource or objectdatasource as I found out. Otherwise you have to make your own events methods for OnPaging and OnSorting. The paging event is simple, but the sorting gets messy and very manual filtering. The builtin paging and sorting events run much better.

    <asp:SqlDataSource id="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:netTiersConnectionString%>" SelectCommandType="StoredProcedure" SelectCommand="_ProjectItems_SelectProjectItemsStatusByProjectIDLocIDS">
    <SelectParameters>
    <asp:Parameter Direction=Input DefaultValue=0 Name="Param1" Type="Int32" />
    <asp:Parameter Direction=input DefaultValue=0 Name="Param2" Type="Int32" />
    <asp:Parameter Direction=input DefaultValue=0 Name="Param3" Type="Int32" />
    </SelectParameters>
    </asp:SqlDataSource>

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