ALL SEX DATING
clear and disable history
Updating dataset asp net
In this article, I am going to explain how to manipulate data using Grid View control.
This article scope is limited to Updating and Deleting records using Grid View and I am not using any readymade Data controls for that but manually writing all event methods.
I will be using Sql objects directly into methods to keep the example simple and straight forward.
That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view).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.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.To populate the Grid View, I am calling Bind Data() method from Page_Load event after checking Is Post Back property of the page, so the Grid View will only be populated when there is no postback on the page (when the page loads for the first time).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.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.