Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have products that categorized by their productCode: I have few models for each code, and i wants to create an image-pager in my datalist. Therefore, I have to use one data source for my datalist and one, based on it, for the repeater (which located in the datalist itemtemplate). of course, any other idea is welcome. here is my current html code:

        <asp:DataList RepeatColumns="4" Width="100%" CssClass="gallery clearfix" ID="DataList1"
        runat="server" DataSourceID="SqlDataSource1">
        <ItemTemplate>
            <div style="direction: rtl; text-align: center">
                <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
                    <ItemTemplate>
                        <div style="text-align: center">
                            <asp:Image ImageUrl='<%# Eval("ImageUrl") %>' ID="ImageThumb" runat="server" />
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <asp:DataPager ID="DataPager1" runat="server" PagedControlID="Repeater1">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Image" FirstPageText="" LastPageText="" NextPageImageUrl="~/images/prettyPhoto/facebook/btnNext.png"
                            PreviousPageImageUrl="~/images/prettyPhoto/facebook/btnPrevious.png" />
                    </Fields>
                </asp:DataPager>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    SelectCommand="SELECT DisplayName, Price, ImageUrl FROM Products WHERE ProductCode=@ProductCode">
                </asp:SqlDataSource>
                <br />
            </div>
        </ItemTemplate>
    </asp:DataList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT ProductCode FROM Products"></asp:SqlDataSource>

does anyone have an answer for me? Thanks!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.