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. Generate click event for items in DataList?

Generate click event for items in DataList?

Scheduled Pinned Locked Moved ASP.NET
question
8 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
    MudkiSekhon
    wrote on last edited by
    #1

    Hi I have a button in my Datalist rows. I want to generate click event for this button in the datalist. Along with the clicking I want to pass row id of that row. How will I do that? Thanks, Sandy

    _ 1 Reply Last reply
    0
    • M MudkiSekhon

      Hi I have a button in my Datalist rows. I want to generate click event for this button in the datalist. Along with the clicking I want to pass row id of that row. How will I do that? Thanks, Sandy

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      Hi, You can use OnItemCommand event to handle your button click event. And to send the row ID you can use the commandargument which you can use in that event. Best Regards, Apurva Kaushal

      M 1 Reply Last reply
      0
      • _ _AK_

        Hi, You can use OnItemCommand event to handle your button click event. And to send the row ID you can use the commandargument which you can use in that event. Best Regards, Apurva Kaushal

        M Offline
        M Offline
        MudkiSekhon
        wrote on last edited by
        #3

        but how can I pass the row ID for the button. I am getting row id from the database. Thanks, Sandy

        _ 1 Reply Last reply
        0
        • M MudkiSekhon

          but how can I pass the row ID for the button. I am getting row id from the database. Thanks, Sandy

          _ Offline
          _ Offline
          _AK_
          wrote on last edited by
          #4

          Hi, There is a property called commandargument for the button there you can set the rowID of that row. This you can do either in the onitemdatabound or at the html section. Best Regards, Apurva Kaushal

          M 1 Reply Last reply
          0
          • _ _AK_

            Hi, There is a property called commandargument for the button there you can set the rowID of that row. This you can do either in the onitemdatabound or at the html section. Best Regards, Apurva Kaushal

            M Offline
            M Offline
            MudkiSekhon
            wrote on last edited by
            #5

            Thanx for ur replies. it really helped me. How can I set the visibility of the button to false on ItemCommand event. I want to set the visibility of the button in DataList to false. How can I do it? Thanks, Sandy

            _ 1 Reply Last reply
            0
            • M MudkiSekhon

              Thanx for ur replies. it really helped me. How can I set the visibility of the button to false on ItemCommand event. I want to set the visibility of the button in DataList to false. How can I do it? Thanks, Sandy

              _ Offline
              _ Offline
              _AK_
              wrote on last edited by
              #6

              Hi, You can iterate through all the items of the datalist and then you can find the image button and then can make that invisible or visible. But the same you can do in the OnItemDataBound event because it also iterates through all the items of the datalist. Hope this will help you. Best Regards, Apurva Kaushal

              M 1 Reply Last reply
              0
              • _ _AK_

                Hi, You can iterate through all the items of the datalist and then you can find the image button and then can make that invisible or visible. But the same you can do in the OnItemDataBound event because it also iterates through all the items of the datalist. Hope this will help you. Best Regards, Apurva Kaushal

                M Offline
                M Offline
                MudkiSekhon
                wrote on last edited by
                #7

                Thanx for the reply. Thanks, Sandy

                _ 1 Reply Last reply
                0
                • M MudkiSekhon

                  Thanx for the reply. Thanks, Sandy

                  _ Offline
                  _ Offline
                  _AK_
                  wrote on last edited by
                  #8

                  always there for it :) Best Regards, Apurva Kaushal

                  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