简体   繁体   中英

How to display file names row-wise in web form?

I read files from Blob named 'pdf' and display in on the asp.net web form. Every file is read displayed in the ListView control. Each file is displayed one after another (side by side), instead of in a new line.

Each file is displayed by name with its hyperlink.

{
    pdfDisplayControl.DataSource = from o in 
     getfileGalleryContainer().GetDirectoryReference("pdf").ListBlobs()
                                       select new { Url = o.Uri };
    pdfDisplayControl.DataBind();

    }

........................................

{
<asp:ListView ID="pdfDisplayControl" runat="server">
<LayoutTemplate>
 <asp:Hyperlink ID="itemPlaceholder" runat="server" />
 </LayoutTemplate>
 <ItemTemplate>
 <asp:Hyperlink ID="pdfhyperlink" Text ='<%# 
  System.IO.Path.GetFileName(Eval("Url").ToString()) %>' runat="server" 
  NavigateUrl='<%# Eval("Url") %>' /> 
  </ItemTemplate>
   </asp:ListView>
  }

All files are displayed as follows:

file1.pdf file2.pdf file3.pdf.

But I want to display as follows:

file1.pdf.
file2.pdf
file3.pdf.

Any idea please?

just add a css style of display:block to your hyperlink:

 <asp:Hyperlink style="display:block" ID="pdfhyperlink" Text ='<%# 
  System.IO.Path.GetFileName(Eval("Url").ToString()) %>' runat="server" 
  NavigateUrl='<%# Eval("Url") %>' />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM