0

Hello, i tryin to find some code to handle some situation in webpage using C# and asp.net. I have site with membership, every user have a folder with his name (if UserName is xxyyxx so the folder have the same name xxyyxx) the folder contain lots of images. i want to display all images in a repeater from the user folder by the username. the images is not records inDB all the images upload by the site manager to the folder by FTP. the code need to display the images by the url request query string (the user name) any Idea?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

I have used IO and Collection classes,

.aspx markup

<form id="form1" runat="server">
    <div>
        <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
         <asp:Image ID="img1" runat="server" ImageUrl='<%#Eval("Key")%>' />
        </ItemTemplate>
        </asp:Repeater>
    </div>

.cs - code behind

protected void Page_Load(object sender, EventArgs e)
    {
        string username = "xxyyxx";
        Dictionary<string,string>  t=System.IO.Directory.GetFiles(MapPath(username)).ToDictionary(p => username + "/" + System.IO.Path.GetFileName(p));
        Repeater1.DataSource = t;
        Repeater1.DataBind();
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.