I am making a project for my high school studies in the field of asp.net and css (c#).
As you probably understand i'm not very good at this subject, as a matter of a fact i'm a total beginner.
My goal is to create a picture gallery (in a website) that gets the path of the pictures from a database using a datalist.
after a while i understood that too many pictures will cause problems in the website.
so I thought about paging, but as I understood after a short investigation online there is no paging function for Datalists. So... i would be really glad if any of you can help me understanding how may i do such a thing (use paging with datalists).
If any of you can write the exact code for me so i can check it out it might help me understand even more.
Additional Information: I'm using microsoft web developer 2010 express, I'm really new to this so an explanation in addition to the code would be great (if possible).
ASP/HTML CODE:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Gallery.aspx.cs" Inherits="Gallery" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:DataList ID="DataList1" runat="server" RepeatColumns="4" CellSpacing="10" HorizontalAlign="Center" >
<ItemTemplate>
<img src='<%# Eval("Path") %>' height="150" width="150" />
</ItemTemplate>
</asp:DataList>
</asp:Content>
css code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Gallery : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds = DAL.ShowAllPictures();
DataList1.DataSource = ds;
DataList1.DataBind();
}
}
Thank you in advance, Assaf.