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. General Programming
  3. C#
  4. DataList item command

DataList item command

Scheduled Pinned Locked Moved C#
question
5 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.
  • M Offline
    M Offline
    mohitmastermind
    wrote on last edited by
    #1

    I want to know which button is clicked on datalist item command i am having three buttons in itemcommand . how can i get the click event of particular button?

    M D R 3 Replies Last reply
    0
    • M mohitmastermind

      I want to know which button is clicked on datalist item command i am having three buttons in itemcommand . how can i get the click event of particular button?

      D Offline
      D Offline
      DannyAdler
      wrote on last edited by
      #2

      Hi there, There are probably a few ways for doing that. I use a switch: protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { switch (e.CommandName) { case "Edit": //do somthing break; case "Delete": //do somthing break; } } Hope it helps. Danny

      M 1 Reply Last reply
      0
      • M mohitmastermind

        I want to know which button is clicked on datalist item command i am having three buttons in itemcommand . how can i get the click event of particular button?

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

        DataListCommandEventArgs e using e.commandName we can check for button command event.

        1 Reply Last reply
        0
        • D DannyAdler

          Hi there, There are probably a few ways for doing that. I use a switch: protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { switch (e.CommandName) { case "Edit": //do somthing break; case "Delete": //do somthing break; } } Hope it helps. Danny

          M Offline
          M Offline
          mohitmastermind
          wrote on last edited by
          #4

          it worked . Thanks Danny , keep the good words going on.

          1 Reply Last reply
          0
          • M mohitmastermind

            I want to know which button is clicked on datalist item command i am having three buttons in itemcommand . how can i get the click event of particular button?

            R Offline
            R Offline
            Rajkumar Chaurasiya
            wrote on last edited by
            #5

            Hi danny Give the Command name to the buttons and check the Command name in ItemCommand Event like this if(e.Commandname=="Add") { //Do Something here. }

            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