Binding return value of SqlDataSource to some tag RRS feed

  • Question

  • User1352601651 posted


    I have a structure like this:

    <asp:Repeater ID="someId" DataSourceID="someDataId" runat="server">

                    <%# DataBinder.Eval(Container.DataItem, " ???? ").ToString() //how can I get return value here? %>



    <asp:SqlDataSource ID="someDataId" runat="server" ConnectionString="<%$ MyConnString %>"
            CancelSelectOnNullParameter="False" SelectCommand="mySPName" SelectCommandType="StoredProcedure">       
                <asp:Parameter Direction="ReturnValue" DbType="Int32" Name="return_value" DefaultValue="0" />  <%--is it right?--%>
                <asp:SessionParameter DefaultValue="1" Name="inputValue" SessionField="inputValue" Type="Int32" />

    I can get any data from sql data source by using DataBinder except returned value. How can I also get return value?

    Thank you.

    Monday, January 24, 2011 5:24 PM

All replies

  • User1224194097 posted

    Just use SELECT yourVariableName as SomeColumnName in the stored procedure.

    You can extract ColumnName in the repeater as

    <%# Eval("SomeColumName").ToString() %>

    Monday, January 24, 2011 6:45 PM
  • User1352601651 posted

    I know how to get a column from stored procedure. I need to get return value. Because I need to get row count value, and in some reasons I can't add row count value into the result table in my stored procedure.

    Monday, January 24, 2011 7:12 PM