Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to link to PDF files from datalist? [modified]

How to link to PDF files from datalist? [modified]

Scheduled Pinned Locked Moved ASP.NET
questiondatabasecomsysadmindocker
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Meax
    wrote on last edited by
    #1

    i like to display report names in a data list and when the user clicks open the corresponding PDF file. all the reports are in PDF format. Report 1 Report 2 Report 3 Report 4 Report 5 how can i do this? i am saving pdf files path in database(http://www.mysite.com/reports/Report1.pdf) my current code shows the report name but when i click it doesn't go anywhere. <asp:datalist id="DL1" runat="server" ItemStyle-BackColor="#c7c7c6" ItemStyle-BorderColor="#c7c7c6" CssClass="Titles"> <ItemTemplate> <asp:HyperLink Runat ="server" NavigateUrl ='<%#DataBinder.Eval(Container.DataItem, "ReportURL")%>' ID="Hyperlink1"> <%#DataBinder.Eval(Container.DataItem, "ReportName")%> </asp:HyperLink> </ItemTemplate> </asp:datalist> code behind Private Sub GetReports() Dim objConnection As SqlConnection = New _ SqlConnection(ConfigurationManager.ConnectionStrings("MyDbConn").ToString()) objConnection.Open() Dim myCommand As New System.Data.SqlClient.SqlCommand() myCommand.Connection = objConnection myCommand.CommandText = "SelectReports" myCommand.CommandType = CommandType.StoredProcedure Dim param As New System.Data.SqlClient.SqlParameter() Dim myAdapter As New SqlDataAdapter(myCommand) myAdapter.Fill(DataSetReports) Dim reader As SqlDataReader = myCommand.ExecuteReader() DL1.DataSource = DataSetReports DL1.DataBind() objConnection.Close() End Sub

    modified on Monday, January 25, 2010 1:21 AM

    A 1 Reply Last reply
    0
    • M Meax

      i like to display report names in a data list and when the user clicks open the corresponding PDF file. all the reports are in PDF format. Report 1 Report 2 Report 3 Report 4 Report 5 how can i do this? i am saving pdf files path in database(http://www.mysite.com/reports/Report1.pdf) my current code shows the report name but when i click it doesn't go anywhere. <asp:datalist id="DL1" runat="server" ItemStyle-BackColor="#c7c7c6" ItemStyle-BorderColor="#c7c7c6" CssClass="Titles"> <ItemTemplate> <asp:HyperLink Runat ="server" NavigateUrl ='<%#DataBinder.Eval(Container.DataItem, "ReportURL")%>' ID="Hyperlink1"> <%#DataBinder.Eval(Container.DataItem, "ReportName")%> </asp:HyperLink> </ItemTemplate> </asp:datalist> code behind Private Sub GetReports() Dim objConnection As SqlConnection = New _ SqlConnection(ConfigurationManager.ConnectionStrings("MyDbConn").ToString()) objConnection.Open() Dim myCommand As New System.Data.SqlClient.SqlCommand() myCommand.Connection = objConnection myCommand.CommandText = "SelectReports" myCommand.CommandType = CommandType.StoredProcedure Dim param As New System.Data.SqlClient.SqlParameter() Dim myAdapter As New SqlDataAdapter(myCommand) myAdapter.Fill(DataSetReports) Dim reader As SqlDataReader = myCommand.ExecuteReader() DL1.DataSource = DataSetReports DL1.DataBind() objConnection.Close() End Sub

      modified on Monday, January 25, 2010 1:21 AM

      A Offline
      A Offline
      April Fans
      wrote on last edited by
      #2

      No difference between link button in datagrid and link button in datalist. Something else is causing problem to u.

      April Comm100 - Leading Live Chat Software Provider

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups