Updating database through datagrid vb net teen online dating statistics
So I have to specify how I want them to appear in the normal view and edit view.
That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view).
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.
You can notice that I have kept Required Field Validator too inside the Edit Item Template as I want the textbox to be validated for empty data.
In the same way you can put any kind of Validation controls inside Edit Item Template to validate the form element while user will click Update link.
In this article, I am going to take a simple database table that has following fields: Auto ID - Int, Auto Increment, Primary Key Page Name - Varchar(50) Page Description - Varchar(500) Active - Bit(1) In this article, I am not going to explain the workings of Sql objects but focusing on the events and methods of the Grid View that will help us in updating and deleting the records.
I have never used the Ole Db Data Adapter & Ole Db Command and am not sure what I am doing. In this method, I am specifying the Edit Index property of the Grid View to -1.As there is no row at -1 position so Grid View will be shown in normal mode.This will make sure that Bind Data() method will not fire when you are going to edit, update or delete the record.In Bind Data() method, I am getting the data from database using Sql objects and specifying the Data Source property of the Grid View to the Pages Data table of the Data Set.
Keep getting this err msg at the high-lighted code, "Object reference not set to an instance of an object".