Click here to Skip to main content
12,400,183 members (59,417 online)
Rate this:
Please Sign up or sign in to vote.
I am making a project for my high school studies in the field of 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).

<%@ 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 ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <asp:DataList ID="DataList1" runat="server" RepeatColumns="4" CellSpacing="10" HorizontalAlign="Center" >
                <img src='<%# Eval("Path") %>' height="150" width="150" />

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;



Thank you in advance, Assaf.
Posted 25-Feb-13 4:58am
Updated 25-Feb-13 5:01am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I hope it's allowed by the rules to comment on my own thread.
This doesn't look SO hard, i know... but it's hard for me and
any tiny tip would help me alot.
Sandeep Mewara 25-Feb-13 13:52pm
Yes, comment is allowed but not a solution which is a comment. You have posted a comment as solution.

You can use 'Have a question or comment?' link to add comment. OR use 'Improve Question' to edit/update question at any point of time.
Rorschachs 26-Feb-13 4:43am
That's clear sir. :P
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Rorschachs 26-Feb-13 4:42am
First of all, thank you for the fast response.
I know it's allot to ask for but I still doesn't understand how can I make the paging for my page.
I tried, but as I told you i'm pretty new to programming.
any more help would be great :)
Sandeep Mewara 26-Feb-13 5:25am
I shared direct articles explaining how it can be done with sample codes. If that was not too helpful, I doubt it would be easy to get more online help. Catch someone in person.
Rorschachs 26-Feb-13 6:26am
Ok, thank you for your help.. I will try to understand. :)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100