Updating data in gridview best single parent dating site australia
24-May-2020 01:13
Please note that when you will not bind the data again, Grid View will not change in edit mode.When Cancel link is clicked on Grid View in edit mode, On Row Canceling Edit event will fire that will call Cancel Record method.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.In this method, we have to get changed values of Text Box and Drop Down list and also we need the primary key value for the record that is being edited.With the help row variable, I am going to find all the controls placed under that row in edit mode using Find Control property.
Now I have declared a Grid View Row variable named row and stored the current row being edited into it.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.After successfully deleting records, again I am calling Bind Data() method to rebind the Grid View.For Page Name and Page Description field I want them to appear in the Text Box in edit view, so I have specified text property of Text Box as the field value in Edit Item Template and for Active field, I want it to appear as the Drop Down List so I have specified the Selected Value property as the value of the Active field.
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.