首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >'System.IO.FileInfo‘不包含'FileName’的定义

'System.IO.FileInfo‘不包含'FileName’的定义
EN

Stack Overflow用户
提问于 2011-04-11 10:53:23
回答 1查看 1.7K关注 0票数 0
代码语言:javascript
复制
<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>

这是我的网格视图标记,下面是绑定部分

代码语言:javascript
复制
    DirectoryInfo ProviderFolder = new DirectoryInfo(strFolderPath);
    FileInfo[] BrochureList = ProviderFolder.GetFiles();
    if (BrochureList.Length > 0)
    {
        GrdVw_Download.DataSource = BrochureList;
        GrdVw_Download.DataBind();
    }

在这行的网格视图中,<a href="?dl=<%# Encyptor.encrypt(((FileInfo)Container.DataItem).FullName),我得到了post提到的错误。其中,Encryptor加密FilePath,标记生成一个链接来下载文件编辑--对不起:*解决了它。*它不是FileName,而是Name.Sorry。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-11 10:56:05

这是因为'System.IO.FileInfo‘不包含'FileName'的定义

你是在找FullName还是Name

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5620261

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档