Click here to Skip to main content
15,899,314 members

Comments by masoud_sedighy (Top 16 by date)

masoud_sedighy 25-Feb-13 14:52pm View    
i added source of page to question
masoud_sedighy 27-Nov-12 10:28am View    
i have some folders with this structure in web server Document/Detail Engineering/Building and then paste some pdf files in that. now the tree view shows folders & files but i like when click on each pdf file in the tree view dialogue box of download comes up and i can open or save pdf file.
masoud_sedighy 27-Nov-12 8:54am View    
i did it, but does not works.
masoud_sedighy 23-Nov-12 8:44am View    
what i understand is the nodes in the same level must be have the same parentid and if level depth is more parent id also must be more for excample if level depth is 1 parent id of same levels should be 1000 and if level depth is 2 parent id of same levels should be 2000, if level depth increase parent id also must increase for example parent id of level depth 2 can not be 1000 and parent level depth 1 2000.
masoud_sedighy 25-Mar-12 4:56am View    
Actually my question comes about how to use "Server.MapPath" function when files and my web application are not in the same directory.
For example I like to use something like the below code when directories are not the same.
The samples I have seen in the net like below are in the same directory.


protected void lnkPath_OnClick(object sender, EventArgs e)
{
GridViewRow datarow = (GridViewRow)(((Control)sender).NamingContainer);
int i = datarow.RowIndex;
foreach (GridViewRow rowItem in grdv.Rows)
{
if (rowItem.RowIndex == i)
{
string filename = rowItem.Cells[0].ToString();
if (filename != "")
{
string path = Server.MapPath(filename);
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
else
{
Response.Write("This file does not exist.");
}
}
}
}
}