|
-
Jul 29th, 2007, 08:45 AM
#1
Thread Starter
Addicted Member
[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
-
Jul 29th, 2007, 01:37 PM
#2
New Member
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.
Last edited by the_menace; Jul 29th, 2007 at 01:40 PM.
-
Jul 30th, 2007, 04:31 PM
#3
Thread Starter
Addicted Member
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.
-
Jul 30th, 2007, 05:06 PM
#4
New Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|