如何从占位符下载文件 [英] how to download files from a placeholder

查看:87
本文介绍了如何从占位符下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个占位符控件,我已经添加了文件夹中的文件。我还为每个文件绑定了一个复选框如果单击复选框,我如何下载文件。



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" önclick="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=" <br mode="hold" />       + @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

推荐答案

这篇关于如何从占位符下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆