0

I have a placeholder control where i have added the files from my folder. I have also binded a check box with each file How i can download the files if checkbox is clicked.

string strDir = Request.QueryString["d"] == null ? FileBrowerProperty.IntialPath : Request.QueryString["d"];

//read the directory
DirectoryInfo DirInfo = new DirectoryInfo(strDir);
//read the subdirectories inside the parent directory
DirectoryInfo[] subDirs = DirInfo.GetDirectories();
//read the files in the parent directory
FileInfo[] Files = DirInfo.GetFiles();

foreach (DirectoryInfo di in subDirs)
{
    ListItem listitem1 = new ListItem(di.FullName);
    // <a href='more.php' onclick='show_more_menu()'>More >>></a>
    //add the directory info to our table 
    LiteralControl lcFolders = new LiteralControl(@"<TR><TD style='WIDTH: 20px'><input type='checkbox' id='"
       + @di.FullName
       + "'>Directory</TD><TD style='WIDTH:350px'><a href='webform1.aspx?d=" 
       + @di.FullName + "'>" + di.Name + "</a></TD><TD style='WIDTH: 150px'>" 
       + di.CreationTime + "</TD><TD style='WIDTH: 150px'>" + di.LastWriteTime 
       + "</TD></TR>");

    PlaceHolder1.Controls.Add(lcFolders);  
}

How to download files from a placeholder control if checkbox is clicked if its not possible then plz tell me that how can i loop through the contents of the placeholder so that i can findout the checkbox and then supply the file name to download the file

Edited by sadaquat_1: code

2
Contributors
1
Reply
8
Views
3 Years
Discussion Span
Last Post by new_nano
0

use checkboxList at server side and use onSelectedIndexChanged or onTextChanged to download file...

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.