<asp:GridView runat="server" id="GrdVw_Download">
<RowStyle cssclass="ItemStyle" />
<HeaderStyle cssclass="tableheader" horizontalalign="Left" />
<AlternatingRowStyle cssclass="AlternateItemStyle" horizontalalign="Left" />
<FooterStyle backcolor="#5D7B9D" font-bold="True" forecolor="White" />
<Columns>
<asp:BoundField headertext="File name" headerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center"
datafield="FileName" />
<asp:BoundField headertext="File Size" headerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center"
dataformatstring="{0:#,### bytes}" datafield="Length" />
<asp:BoundField headertext="Extension" headerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center"
datafield="Extension" />
<asp:TemplateField headertext="Download Brochure" itemstyle-horizontalalign="Center"
headerstyle-horizontalalign="Center">
<ItemTemplate>
<a href="?dl=<%# Encryptor.encrypt(((FileInfo)Container.DataItem).FullName) %>"
title="Download <%# ((FileInfo)Container.DataItem).FileName %>">
<%# ((FileInfo)Container.DataItem).FileName %>
</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
这是我的GridView标记和下面是绑定部分“System.IO.FileInfo”不包含定义“文件名”
DirectoryInfo ProviderFolder = new DirectoryInfo(strFolderPath);
FileInfo[] BrochureList = ProviderFolder.GetFiles();
if (BrochureList.Length > 0)
{
GrdVw_Download.DataSource = BrochureList;
GrdVw_Download.DataBind();
}
在GridView在此行<a href="?dl=<%# Encyptor.encrypt(((FileInfo)Container.DataItem).FullName)
我得到的错误该职位谈到。 Where Encryptor加密FilePath和标记生成链接以下载文件 编辑对不起: * 解决了它。 *它不是文件名,但只是Name.Sorry再次
与问题标题中添加“[Solved]”相反,您应该接受实际解决问题的答案。 – 2011-04-11 11:03:46
@Martin感谢您的信息。我会接受一个答案是他在更新之前发布了解决方案。虽然我正在更新我犯的错误问题。 – Deeptechtons 2011-04-11 11:22:18