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. GridView & ImageButton

GridView & ImageButton

Scheduled Pinned Locked Moved ASP.NET
sysadmin
6 Posts 4 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.
  • C Offline
    C Offline
    comp_j
    wrote on last edited by
    #1

    Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance

    A H S 3 Replies Last reply
    0
    • C comp_j

      Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Try to trap Index from RowCommand event of GridView

      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article

      C 1 Reply Last reply
      0
      • A Abhijit Jana

        Try to trap Index from RowCommand event of GridView

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article

        C Offline
        C Offline
        comp_j
        wrote on last edited by
        #3

        What do I write in RowCommand event ?

        A 1 Reply Last reply
        0
        • C comp_j

          Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance

          H Offline
          H Offline
          Hemant Thaker
          wrote on last edited by
          #4

          You can code like this inside Row_Command event int row_index = int.parse(e.CommandArgument.ToString()) Now row_index will have row index (which row's button u have clicked) Now u can access any value string abc = grd1.rows[row_index].cells[2].text.tostring()

          By: Hemant Thaker

          1 Reply Last reply
          0
          • C comp_j

            What do I write in RowCommand event ?

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            comp_j wrote:

            What do I write in RowCommand event ?

            Read this MSDN Article : It will help you for future too[^] ;)

            Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article

            1 Reply Last reply
            0
            • C comp_j

              Hello, I put an ImageButton field on my GridView.I want this: when I clicked on the ImageButton, value of that row's ID field must returned that is selected with ImageButton . (I know my english is awful :) ) ImageButton code: <ItemTemplate> <asp:ImageButton runat="server" id="IMG1" ImageUrl='My URL' /> </ItemTemplate> Thnaks in advance

              S Offline
              S Offline
              subbareddypvsr
              wrote on last edited by
              #6

              CommandArgument=<%#Container.DisplayIndex + 1 %> give this in image button and get the index by using this int.Parse(e.CommandArgument.ToString())

              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