0

I want to create an items compare page just like this: http://www.autotrader.com/fyc/compare.jsp?sownerid=855612&end_year=2014&start_year=1981&keywordsfyc=&search_type=both&scarid=326877152&distance=10&default_sort=priceDESC&address=11413&sort_type=priceDESC&firstRecord=1&num_records=25&seller_type=b&keywords_display=&compare=305557040&compare=319902555&compare=337325579

(this is a compare page from autotraders.com)

I have been searching fourms for a week now , trying all possible solutions, some say use GridView, some say use ListView, I tried many things, custom div css as well, but couldn't do it. Basically, I want to show vertical rows (side by side rows) instead of default horizontal rows. Appreciate any help.

user1744509
  • 5
  • 1
  • 6

2 Answers2

0

You can make use of Repeater control or DataList control.

More on Repeater or DataList

i would personally go for Repeater .

Example:

<asp:Repeater ID="ExampleRepeater" runat="server" >
    <HeaderTemplate>
        <table>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <asp:Label runat="server" ID="lblCategory" Text='<%# Eval("YouColumnName") %>' > </asp:Label>
            </td>

            <td>
                <asp:ImageButton ID="imgButton" runat="server" ImageUrl='<% #Eval("YourImageColumn %>'></asp:ImageButton>
            </td>
            <td>
                <asp:Label runat="server" ID="lblOtherInfo" Text='<%# Eval("YouColumnName") %>' > </asp:Label>
            </td>
       </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>
Praveen Nambiar
  • 4,852
  • 1
  • 22
  • 31
  • Thank for the reply... But the example shows horizontal rows... what I need is vertical rows... and the headers shows at the left horizontally... – user1744509 Mar 09 '13 at 08:25
  • in a repeater control you can render the html the way you want it. also mark the answer as useful so that it mite help others. – Praveen Nambiar Mar 09 '13 at 08:28
  • I'll appreciate it if you have an example. – user1744509 Mar 09 '13 at 09:03
  • check a sample...and tweak it as per your requirement. Repeater i believe would be best in your scenario. – Praveen Nambiar Mar 09 '13 at 09:29
  • Thnaks... I just tried it... it is ok... but How can I display the column names only one time on the left and the rows side-by-side – user1744509 Mar 09 '13 at 09:33
  • thats exactly the above repeater example will do. if you notice it has on and three . So the first will act like your header and the other two will act like images or labels or whatever you wanna set. u can include more if you want. more means more rows side by side. Also, mark the answer as usefull so that it will help others too. – Praveen Nambiar Mar 09 '13 at 09:36
  • Thanks a million ... Repeater With Table Design Worked.... Very straight Forward. – user1744509 Mar 09 '13 at 10:39
0

I think you could use this answer to solve your problem. It works i checked it. And use this article to designe your comparison table

Community
  • 1
  • 1
Adalyat Nazirov
  • 1,611
  • 2
  • 14
  • 28