Confirm delete on DataGrid
-
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.
-
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.
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.
-
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.
You can refer the article in the link http://www.dotnetjohn.com/articles/articleid68.aspx[^]
-
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.
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.