databind result in new query RRS feed

  • Question

  • User-722322667 posted

    Dear Users,

    I am new to ASP.Net and have  a lot of help with this forum, but sometimes you can't find your answer.

    I am having a  DataList on my page for small news items (like a newsreader), every newsitem has it's own image which comes out-of an other table.
    How can I pass the News_imageId to my Imagequery?

    <asp:SqlDataSource ID="SqlView_Image" runat="server"
        ConnectionString="<%$ ConnectionStrings%>"
        SelectCommand="View_Image" SelectCommandType="StoredProcedure">
            <asp:Parameter DefaultValue="<%# Eval("News_Image") %>" Name="p1" Type="Int32" />

     The underlined part gives an error, how can I solve this problemn?
    The code above is set within the Datalist for the Newsreader.

    Many thanks for your help,


    Thursday, January 20, 2011 3:50 AM


  • User2050872319 posted

    I don't think it's possible to do it in a declarative way, but it's possible to do it in the code-behind:

    SqlView_Image.SelectParameters("p1").DefaultValue = News_Image


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 20, 2011 6:49 AM