title: How to file upload and view the datalist
body: <p>I insert the code;</p>
  
  <p>HTML:</p>
  
  <pre><code>                &lt;asp:Label ID="document" runat="server" Text="Document"&gt;&lt;/asp:Label&gt;
                  &lt;asp:TextBox ID="name" runat="server" AutoPostBack="true"&gt;&lt;/asp:TextBox&gt;
  
                  &lt;asp:Label ID="upload" runat="server" Text="Upload Document"&gt;&lt;/asp:Label&gt;
                  &lt;asp:FileUpload ID="FileUpload1" runat="server" multiple="true" Style="text-align: center;
                      margin-left: 50px;" Height="27px" /&gt;
  
      &lt;asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="UploadFile" CommandName="Add" /&gt;
  
      &lt;asp:DataList ID="datalist" runat="server" RepeatColumns="5" CellPadding="5" BorderWidth="25px"
          CellSpacing="2" Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
          Font-Underline="False" GridLines="Both"&gt;
          &lt;HeaderTemplate&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;th&gt;
                          My Folder
                      &lt;/th&gt;
                  &lt;/tr&gt;
          &lt;/HeaderTemplate&gt;
          &lt;ItemTemplate&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;asp:TextBox ID="name" runat="server" EnableViewState="true"&gt;&lt;/asp:TextBox&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                      &lt;asp:LinkButton ID="lnkDownload" Text="Download" CommandArgument='&lt;%# Eval("Value") %&gt;'
                          runat="server" OnClick="DownloadFile" /&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                      &lt;asp:LinkButton ID="lnkDelete" Text="Delete" CommandArgument='&lt;%# Eval("Value") %&gt;'
                          runat="server" OnClick="DeleteFile" /&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
          &lt;FooterTemplate&gt;
              &lt;ul class="pager"&gt;
                  &lt;li class="previous"&gt;&lt;a href="#"&gt;Previous&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="next"&gt;&lt;a href="#"&gt;Next&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/FooterTemplate&gt;
      &lt;/asp:DataList&gt;
  </code></pre>
  
  <p>VB:</p>
  
  <pre><code>Dim lsfilename As String
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
      If Not IsPostBack Then
          Dim filePaths() As String = Directory.GetFiles(Server.MapPath("..\Fileupload\insert\"))
          Dim files As List(Of ListItem) = New List(Of ListItem)
          For Each filePath As String In filePaths
              files.Add(New ListItem(Path.GetFileName(filePath), filePath))
          Next
          datalist.DataSource = files
          datalist.DataBind()
      End If
  End Sub
  Protected Sub UploadFile(ByVal sender As Object, ByVal e As EventArgs)
      Dim fileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
      FileUpload1.PostedFile.SaveAs((Server.MapPath("..\Fileupload\insert\") + name.Text))
      lsfilename = name.Text
      Response.Redirect(Request.Url.AbsoluteUri)
  End Sub
  Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
      Dim filePath As String = CType(sender, LinkButton).CommandArgument
      Response.ContentType = ContentType
      Response.AppendHeader("Content-Disposition", ("attachment; filename=" + Path.GetFileName(filePath)))
      Response.WriteFile(filePath)
      Response.End()
  End Sub
  Protected Sub DeleteFile(ByVal sender As Object, ByVal e As EventArgs)
      Dim filePath As String = CType(sender, LinkButton).CommandArgument
      File.Delete(filePath)
      Response.Redirect(Request.Url.AbsoluteUri)
  End Sub
  
  Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
      datalist.DataBind()
  End Sub
  </code></pre>
  
  <p>But, its not display the file name and how to write the previous and next button code. I want only insert the 9 files after that its going to next page. Please any one help to me.</p>
  
  <p>Thanks,</p>