Click to See Complete Forum and Search --> : paging with DataList while datasource is.......


bhuraasif
June 11th, 2007, 07:24 AM
Hi everyone,


I want to show paging in my datalist. working with C#.


i have code as given below.which is working fine to display all images from particular folder in datalist,

but i want to give paging in this datalist.which is not related to database.it directly fetches all images from particular directory and displaying in datalist.

please show me how to paging with it.


string getfp;
string MainDir;
protected void Page_Load(object sender, EventArgs e)
{


getfp = Request.QueryString.Get("p");
if (getfp == "" // getfp == null)
{
getfp = "eventspic";
}
else
{
getfp = getfp + "pic";
}
MainDir = getfp;

ArrayList al = new ArrayList();
foreach (string s in Directory.GetDirectories(Server.MapPath("../" + getfp + "/"), "*.*"))
{

string html;
int no = 23;
no += getfp.Length;
no += 1;
string fn = s.Substring(no);
html = "<a href=\"default.aspx?fm=" + MainDir + "&fs=" + fn + "\">" + "<img border=\"0\" src=\"../images/largefolder.gif" + "\">" + "</a>" + "<br />" + fn;
al.Add(html);
}
dlPictures.DataSource = al;
dlPictures.DataBind();
}


waiting for positive reply.

Best regards,
ASIF