Results 1 to 4 of 4

Thread: [2005] GridView (Edit , Save , ) buttons

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    [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

  2. #2
    New Member the_menace's Avatar
    Join Date
    Jul 2007
    Location
    Sacramento, CA
    Posts
    12

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    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.

  4. #4
    New Member the_menace's Avatar
    Join Date
    Jul 2007
    Location
    Sacramento, CA
    Posts
    12

    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
  •  



Click Here to Expand Forum to Full Width