Updating records in the database with asp net

When Delete link of the Grid View will be clicked, it will confirm the user whether they really want to Delete the record, if they will click OK, it will fire On Row Deleting event of the Grid View that will call Delete Record method.

In this method again, I am getting the primary key value using Data Keys property of the Grid View and using it to delete the records from the database.

You may notice that the last column of the Grid View is a Delete column that let user delete the record from database, so I have placed Delete link button inside the tag and have specified on Click property as Java Script confirm return value, so that when user clicks on it he/she sees a confirmation box whether he/she really wants to delete the record.

Till now our Grid View is ready to be populated, now let’s write a method to populate the Grid View.

Now I have declared a Grid View Row variable named row and stored the current row being edited into it.

When Update link of the Grid View will be clicked (in edit mode), On Row Updating event will fire that will call Update Record method.After successfully deleting records, again I am calling Bind Data() method to rebind the Grid View.Hope this article helps to begin working with Grid View control. Right now I have a label turn to visible true and a message when someone either edits or deletes something successfully.In this method, I am specifying the Edit Index property of the Grid View to the New Edit Index of the Grid View and then calling Bind Data() method again to bind the data.Please note that when you will not bind the data again, Grid View will not change in edit mode.

Leave a Reply

  1. Dating m4m 02-May-2020 18:25

    Kenyan Cupid is part of the well-established Cupid Media network that operates over 30 reputable niche dating sites.

  2. Adults chatting about swing 06-Jan-2020 21:26

    While he was working on his debut album, Wicks was also picked as a cast member of the Fox network reality TV series Nashville.

  3. dating of rocks ppt 16-May-2020 01:36

    "We found out he was married," said a disheartened 22-year-old Jessie Sharcoff of New York.