[2005] GridView (Edit , Save , ) buttons
Hi , a GridView has (Edit) button or ( Save ) button if Editing was enabled.
My question is , if I want some other actions to happen when the user clicks on the (Edit) or (Save) button , say , I want the used to be asked if he is sure he wants to (Save) the changes before the save action occur.
How do I achieve that ?
Thank you
Re: [2005] GridView (Edit , Save , ) buttons
You can use this concept and apply to yours.
Code:
Sub DataGrid_ItemCreated(Sender As Object, e As DataGridItemEventArgs)
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
Dim myDeleteButton As Button
myDeleteButton = e.Item.FindControl("btnDelete")
myDeleteButton.Attributes.Add("onclick",_
"return confirm('Are you sure you want to delete this data?');")
End Select
End Sub
As an alternative, you can also add the attribute during page load.
Hope that helps a little.
Re: [2005] GridView (Edit , Save , ) buttons
I don't have a button called "btnDelete" , should I add a button by that name ? I know how to add a button to a gridview , but I don't know if I can change the name of the button.
Re: [2005] GridView (Edit , Save , ) buttons
My example was just a model.\
Post your code for your grid view so we can look at what you see, there should be a section where you can set the ID for edit and save.