Click here to Skip to main content
13,085,936 members (88,460 online)
Rate this:
Please Sign up or sign in to vote.
Hello Friends,
I m using File Directory , to bind Data List. I m Displaying My Code here:

<asp:DataList ID="dtlist"  RepeatDirection="Horizontal" runat="server" RepeatColumns="4" CellPadding="3">
 <asp:Image ID="Image1" ImageUrl='<%# Bind("Name", "~/Images/{0}") %>' runat="server" Height="75px" Width="100px" />                                                                                                      
 <br />
 <asp:HyperLink ID="HyperLink1" Text='<%# Bind("Name") %>' NavigateUrl='<%# Bind("Name", "~/Images/{0}") %>' runat="server"/>
 <br /> 
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" 
 onclick="dtlist_SelectedIndexChanged1" style="text-align: center">Delete</asp:LinkButton>
<ItemStyle BorderColor="Brown" BorderStyle="dashed" BorderWidth="3px" HorizontalAlign="Center" VerticalAlign="Bottom" />                           

My C# Code Is:

 protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
    protected void BindListView()
        DirectoryInfo dir = new DirectoryInfo(MapPath("~/Images"));
        FileInfo[] files = dir.GetFiles();
        ArrayList listItems = new ArrayList();
        foreach (FileInfo info in files)
        dtlist.DataSource = listItems;
 protected void dtlist_SelectedIndexChanged1(object sender, EventArgs e)
        Control c = sender as Control;
  System.Web.UI.WebControls.Image img ((System.Web.UI.WebControls.Image)c.Parent.FindControl("Image1"));

The Problem is, as i add images , or upload images, , the page design is increasing.
I want to use paging in my datalist, to arrange in formatted Way,
please help me.
Posted 21-Mar-13 23:51pm

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 |
Web03 | 2.8.170813.1 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2017
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