Now am using Session["Sex"], when Session["Sex"]=="Male" then "~Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" will be traversed....
i'm using one image and one hyperlink field under the DataList control, i want to use ImageButton in place of Image so that on clicking ImageButton, the definit picture from the folder will be shown,
and i want it to happen at runtime, since based on session["sex"] and username, the userfolder having the pics will be selected.....
here's my aspx design code:
Div
and my aspx.cs code::
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
BindDataList();
}
}
protected void BindDataList()//shows the pics from the user folder
{
string[] list = Directory.GetFiles(Server.MapPath("/Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" + txt_u_name.Text + "/"));
var aList = from fileName in Directory.GetFiles(Server.MapPath("/Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" + txt_u_name.Text + "/"))
select string.Format("/Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" + txt_u_name.Text + "/{0}", Path.GetFileName(fileName));
dtlist.DataSource = aList;
dtlist.DataBind();
}
i'm not using any database regarding folder pics, is there a way so that i can replace the Image inside the DataList by a ImageButton, so that when i click the button, it opens the coressponding image in a new page, or rather in a lightbox.....also i want to use a delete button inside the Datalist along with the ImageButton, so that i can delete the corresponding image from the folder....Can this be done and without using the concept of database?? Any help is appreciated.....
vijayPosted Jan 2, 2012, 6:17 AM
Refer the below link......
http://www.dotnetcode.in/2011/06/how-to-store-imageurl-in-database-and.html