In this article I will try to explain you how you can display images as a gallery view using GridView control of ASP.NET.
I face problem of paging when I had tried it with DataList control. In DataList we can de$ne repeat column direction to display images as
gallery. But main problem is paging, and you have to use third party control to apply paging in DataList and it is di'cult to manage with
third party control.
But here I have taken GridView control to display image gallery. With use of internal paging. So we can done all operation very simply on
GridView control.
Lets Start.
1. Code for ASPX page is as follow
<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>
评论0