Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: database Internet Project , +
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.
Posted 25-Feb-13 5:58am
Edited 25-Feb-13 6:01am
v2
Rate this: bad
good
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.
  Permalink  
Comments
Sandeep Mewara at 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 at 26-Feb-13 4:43am
   
That's clear sir. :P
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Comments
Rorschachs at 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 at 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 at 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
0 OriginalGriff 7,105
1 DamithSL 5,079
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,617
4 Kornfeld Eliyahu Peter 4,384


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2014
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