CodeSmith Community
Your Code. Your Way. Faster!

Output parameters and ASP.NET Datasources

Latest post 10-23-2007 1:03 PM by williamwgant. 0 replies.
  • 10-23-2007 1:03 PM

    Output parameters and ASP.NET Datasources

    Hello all,

    I have a page with a repeater on it that is consuming data from a custom stored procedure. This procedure does paging and handles some funky logic under the hood (otherwise I would have used the built-in version). On my stored proc, I'm returning a dataset that nettiers correctly interprets as a particular type of object. In addition, I'm also returning an integer output parameter (@TotalCount) that is the total number of records that would be returned if I wasn't paging the dataset. I have the following code to declare the datasource on the page:

     

    <data:InventoryDetailDataSource CustomMethodRecordCountParamName="TotalCount" ID="datInventoryDetail" Sort="SortKey" runat="server" SelectMethod="GetByInventoryIDAndInventoryBinID_Paged" EnableDeepLoad="true">
        <DeepLoadProperties Method="includechildren" Recursive="true">
            <Types>
                <data:InventoryDetailProperty Name="InventoryItem" />
                <data:InventoryDetailProperty Name="InventoryItemCategory" />
                <data:InventoryItemProperty Name="MasterItem" />
                <data:MasterItemProperty Name="InventoryUnit" />
                <data:ApplicationEntityGLAccountProperty Name="GLAccount" />
                <data:InventoryItemCategoryProperty Name="ApplicationEntityGLAccount" />
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <asp:QueryStringParameter Name="InventoryID" QueryStringField="InventoryID" Type="Int32" />
            <asp:ControlParameter ControlID="cboInventoryBin" PropertyName="SelectedValue" Type="int32" Name="InventoryBinID" />
            <asp:QueryStringParameter QueryStringField="PageSize" Name="PageSize" DefaultValue="50" Direction="input" Type="int32" />
            <asp:QueryStringParameter QueryStringField="PageNumber" Name="PageNumber" DefaultValue="1" Direction="input" Type="int32" />
            <data:SqlParameter Name="TotalCount" Direction="output" Type="int32" DefaultValue="1" />
        </Parameters>
       </data:InventoryDetailDataSource>

     

    Further down the page, I have a custom control for paging (the code that plays nice with the repeater was already written, so I don't want to rip it back out, as there are multiple nested repeaters with a bunch of javascript around them). The paging control needs the value of the TotalCount parameter that is returned from my custom stored procedure. How can I get the actual value being returned instead of "1"?

     

    Thanks,

    Will 

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