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. How to Add a linked image in datagrid

How to Add a linked image in datagrid

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadmintutorial
7 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.
  • N Offline
    N Offline
    nour123
    wrote on last edited by
    #1

    Hi all I have a datagrid, which holds item name, item price, and its image(all from SQL Server database), what I need is when the user clicks on the image, I need the (id) for the item to be carried to the new page where I want to show more details about the item (expiry date, ...) regards

    V A 2 Replies Last reply
    0
    • N nour123

      Hi all I have a datagrid, which holds item name, item price, and its image(all from SQL Server database), what I need is when the user clicks on the image, I need the (id) for the item to be carried to the new page where I want to show more details about the item (expiry date, ...) regards

      V Offline
      V Offline
      Vsree
      wrote on last edited by
      #2

      Hi You can add an imagebutton in the template column and set its ImageURL to the image you wish to display. Then, set the imagebutton's CommandName to the itemID and in its Click event, use the commandname as querystring to navigate to another page and display that id's details... Hope it helps you.. ~VSree

      N 2 Replies Last reply
      0
      • N nour123

        Hi all I have a datagrid, which holds item name, item price, and its image(all from SQL Server database), what I need is when the user clicks on the image, I need the (id) for the item to be carried to the new page where I want to show more details about the item (expiry date, ...) regards

        A Offline
        A Offline
        asithangae
        wrote on last edited by
        #3

        Vsree has said a nice way, we have one more way using html controls. use a anchor tag and inside that use the image tag, set the image src to the image path and href of anchor tag to the redirection path. if you use this way, no need of writting any code to the page. but you have to use the template column any how. cheers asithangae

        N 2 Replies Last reply
        0
        • V Vsree

          Hi You can add an imagebutton in the template column and set its ImageURL to the image you wish to display. Then, set the imagebutton's CommandName to the itemID and in its Click event, use the commandname as querystring to navigate to another page and display that id's details... Hope it helps you.. ~VSree

          N Offline
          N Offline
          nour123
          wrote on last edited by
          #4

          Hi Dear Ok, but how can I bind it to the datagrid Regards

          1 Reply Last reply
          0
          • A asithangae

            Vsree has said a nice way, we have one more way using html controls. use a anchor tag and inside that use the image tag, set the image src to the image path and href of anchor tag to the redirection path. if you use this way, no need of writting any code to the page. but you have to use the template column any how. cheers asithangae

            N Offline
            N Offline
            nour123
            wrote on last edited by
            #5

            Thanks alot but could you please give me a sample code of that Regards,,,

            1 Reply Last reply
            0
            • A asithangae

              Vsree has said a nice way, we have one more way using html controls. use a anchor tag and inside that use the image tag, set the image src to the image path and href of anchor tag to the redirection path. if you use this way, no need of writting any code to the page. but you have to use the template column any how. cheers asithangae

              N Offline
              N Offline
              nour123
              wrote on last edited by
              #6

              Thanks alot Dear... It works... Have a nice day...

              1 Reply Last reply
              0
              • V Vsree

                Hi You can add an imagebutton in the template column and set its ImageURL to the image you wish to display. Then, set the imagebutton's CommandName to the itemID and in its Click event, use the commandname as querystring to navigate to another page and display that id's details... Hope it helps you.. ~VSree

                N Offline
                N Offline
                nour123
                wrote on last edited by
                #7

                Thanks alot Dear... It works... Have a nice day...

                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