Click here to Skip to main content
15,886,724 members
Articles / Web Development / XHTML

Display image gallery in ASP.NET GridView Control

Rate me:
Please Sign up or sign in to vote.
3.56/5 (11 votes)
3 Nov 2008CPOL5 min read 144.4K   7.8K   50  
Here we can use GridView control to display images in a gallery view with internal paging.
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="gallary.aspx.vb" Inherits="gallary" title="Untitled Page" %>
<asp:Content ID="Content4" ContentPlaceHolderID="middlesection" Runat="Server">

  <table border="0" cellpadding="0" cellspacing="0" width="100%">  
  <tr>
           <td align="left">
                         
                            <asp:GridView ID="gvListProperty" runat="server" AutoGenerateColumns="false" Width="100%"
                                border="0" AllowPaging="true" BorderColor="white" cssClass="griditem"   PageSize="10"  >
                                <PagerSettings Mode="Numeric"  Position="TopAndBottom"/>
                                <PagerStyle CssClass="mypager" HorizontalAlign="right" />
                                <Columns>                                    
                                    <asp:TemplateField>
                                         <HeaderStyle CssClass="dispnone" />	
                                        <ItemTemplate>
                                             <table width="100%">
                                                <tr>
                                                    <td class="bdr-grey">                                                    
                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0" Class="griditem" >
                                                            <tr>
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column1")%>
                                                              </td>                                                              
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column2")%>
                                                              </td>                         
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column3")%>
                                                              </td>                         
                                                              <td width="60px" height="60px" Class="griditem" >
                                                              <%#Container.DataItem("Column4")%>
                                                              </td>                                                                                                                                        
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
           
</td>
    </tr>
   </table>             
</asp:Content>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Technical Lead IndiaNIC Infotech Ltd
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions