how to set dynamically created folder path to imz SRC aspx

Posted by Rickeybglr under ASP.NET on 8/2/2012 | Points: 10 | Views : 1639 | Status : [Member] | Replies : 4
Hi all,

i am creating a gallery. so for every user there cud be seprate gallery. for viewing gallery i need to set path of dynamically created folder to imz SRC and Href . how can i achieve ths???

public void loadImageToGallery(string fname)
{
if (!IsPostBack)
{
DirectoryInfo myImageDir = new DirectoryInfo(Server.MapPath("~/images/"+fname+"/"));
DLImz.DataSource = myImageDir.GetFiles();
DLImz.DataBind();
}
}

<asp:DataList ID="DLImz" runat="server" RepeatColumns="5">
<ItemTemplate>
<a href='<%# Eval("Name","~/{0}")%>' rel="myPhoto[gallery]" title="caption">
<img src='<%# Eval("Name","~/{0}")%>' width="60" height="60" alt='<%# Eval("Name") %>' />
</a>

</ItemTemplate>

</asp:DataList>




Responses

Posted by: Jayakumars on: 9/29/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try this


<img src='<%# Filepath("location") %>' runat="server" />



Mark as Answer if its helpful to you

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/29/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Please mark as answer if it helpful to you.

Mark as Answer if its helpful to you

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 9/30/2012 [Member] Starter | Points: 25

Up
0
Down
@jayakumar,

location cud be anythn which can be determine only at runtime..

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Solijoseph on: 10/1/2012 [Member] Starter | Points: 25

Up
0
Down
public void loadImageToGallery(string fname)
{
if (!IsPostBack)
{


string[] list = Directory.GetFiles(Server.MapPath("~/images/"+fname+"/"));
var aList = from fileName in list select string.Format("images/"+ fname +"/{0}", Path.GetFileName(fileName));

DLImz.DataSource = aList;
DLImz.DataBind();
}
}

<asp:DataList ID="DLImz" runat="server" RepeatColumns="5">
<ItemTemplate>
<a href='<%# Container.DataItem %>' rel="myPhoto[gallery]" title="caption">
<img src='<%# Container.DataItem %>' width="60" height="60" alt='<%# Container.DataItem %>' />
</a>

</ItemTemplate>

</asp:DataList>


Should work....



Thanks & Regards
Solimon Joseph

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response