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. Confirm delete on DataGrid

Confirm delete on DataGrid

Scheduled Pinned Locked Moved C#
question
4 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.
  • R Offline
    R Offline
    Reinier van de Wetering
    wrote on last edited by
    #1

    Is there a way to add code to the delete key pressed on a datagrid? I want a messagebox to pop up when the key is pressed to allow the user to confirm or cancel the deltetion of the datagrid row. Thanks, Reinier.

    R S 2 Replies Last reply
    0
    • R Reinier van de Wetering

      Is there a way to add code to the delete key pressed on a datagrid? I want a messagebox to pop up when the key is pressed to allow the user to confirm or cancel the deltetion of the datagrid row. Thanks, Reinier.

      R Offline
      R Offline
      Rob Koval
      wrote on last edited by
      #2

      You need to add an event handler to datagrid for OnItemDataBound event. In that handler you need to lookup a delete button and attach client side script to it. You will do it using button's attribute collection. something like this: myBtn.Attributes.Add("onclick","javascript:myConfirmJSFunction()"); Hope this helps r.

      R 1 Reply Last reply
      0
      • R Reinier van de Wetering

        Is there a way to add code to the delete key pressed on a datagrid? I want a messagebox to pop up when the key is pressed to allow the user to confirm or cancel the deltetion of the datagrid row. Thanks, Reinier.

        S Offline
        S Offline
        Syed Abdul Khader
        wrote on last edited by
        #3

        You can refer the article in the link http://www.dotnetjohn.com/articles/articleid68.aspx[^]

        1 Reply Last reply
        0
        • R Rob Koval

          You need to add an event handler to datagrid for OnItemDataBound event. In that handler you need to lookup a delete button and attach client side script to it. You will do it using button's attribute collection. something like this: myBtn.Attributes.Add("onclick","javascript:myConfirmJSFunction()"); Hope this helps r.

          R Offline
          R Offline
          Reinier van de Wetering
          wrote on last edited by
          #4

          Thanks for the reply. I think you are referring to a datagrid in webforms, i'm looking for a answer on a datagrid in a windows form, when the delete key on keyboard is pressed.

          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