Chat por cam xe xi - Updating in gridview

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.

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.

After that again, I am doing the same thing that I had done in Cancel Record method, I mean setting Edit Index property of the Grid View to -1 and rebinding the data again by calling Bind Data() method.

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.

When Edit link of the Grid View will be clicked then On Row Editing event will fire that will call Edit Record method.

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.

When Cancel link is clicked on Grid View in edit mode, On Row Canceling Edit event will fire that will call Cancel Record method.

I have specified Data Key Names as Auto ID, the primary key of the database table.

Comments are closed.