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
  1. Home
  2. Web Development
  3. ASP.NET
  4. link button in a datagrid column

link button in a datagrid column

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 3 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I am working on a web application, in which i have a datagrid with a template column consisting of linkbuttons. Now if i click each linkbutton one corresponding file ( pdf/doc) should open. How can i write code for this scenario.

    T T 2 Replies Last reply
    0
    • A Anonymous

      I am working on a web application, in which i have a datagrid with a template column consisting of linkbuttons. Now if i click each linkbutton one corresponding file ( pdf/doc) should open. How can i write code for this scenario.

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      Create an event handler for the grid's ItemCommand event (the event will fire when a user presses the linkbutton in the template column). When the event is fired, the event args will include the current row, so you should be able to get whatever information you need about what file you'd like to open. Remember to check which command fired the event if you have more than one button column in the grid. Hope this helps.

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      1 Reply Last reply
      0
      • A Anonymous

        I am working on a web application, in which i have a datagrid with a template column consisting of linkbuttons. Now if i click each linkbutton one corresponding file ( pdf/doc) should open. How can i write code for this scenario.

        T Offline
        T Offline
        Timcyspet
        wrote on last edited by
        #3

        Hi 1. use Template colume in the data grid 2. save the file name in the database use this code code behind Dim keys As String = dg_topic_list.DataKeys(dg_topic_list.SelectedIndex) Dim RedirectPage As String = "../mentoring/mentortopics.aspx" If File.Exists("system path\files\" & data.ReturnDs(sql_str).Tables(0).Rows(0).Item("filename") & ".pdt") Then Response.Redirect("./files/" & data.ReturnDs(sql_str).Tables(0).Rows(0).Item("filename") & ".pdf") End If bye timcyspet

        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