Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display picture in a tabular format,but with the following code below,each picture is keep inserted vertically,
i want picture to be displsy say in a(say)4 * 4 format.please help me

XML
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
        BorderWidth="1px" CellPadding="4" Height="204px"
        HorizontalAlign="Justify" PageSize="5" Width="56px" ShowHeader="False" >
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                 <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# geturl(DataBinder.Eval(Container.DataItem, "img_id"))%>'><asp:Image ID="Image1" runat="server" Height="40" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "img_id")) %>'
                        Width="40" /></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
                                 </Columns>
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
        <PagerSettings NextPageImageUrl="photogallary.aspx" PageButtonCount="4" />
        <RowStyle BackColor="White" ForeColor="#003399" />
    </asp:GridView>
Posted
Comments
raju melveetilpurayil 16-Mar-11 6:32am    
better to use DataList

1 solution

Use Datalist instead of GridView. In Datalist use the properties RepeatColumns="4" & RepeatDirection="Horizontal", that's all.

Display images in DataList from Database[^]

Binding images to a DataList control dynamically[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900