Updating sql using gridview control
Mark Berseth wrote a very interested article about Bulk Insert Data Using List View Control.Basically, the List View control is displayed with the Text Box controls in each row (like MS Excel).Let's start by populating the Grid View control (You can use List View if you prefer).private void Bind Data() And here is the HTML view of the Grid View control.The problem starts when you try to update the data which is already in the database.Let's say you populate the List View with some data and now you want to edit it.In a previous post we saw how easy is to bind data to a Grid View control, without using a build in Data Sources.In this post we will use an Sql Data Source control which will retrieve some data from a database and will bind them to the Grid View control.
At the end of this wizard, a “connection Strings” element will be added to your Web.config file.protected void Update(object sender, Event Args e) The update method simply looks into the Row Index list and finds the changed rows from that list.Now, we only have to update those changed rows and not all the rows.If you try and run the page you will actually see the data in the Grid View. So we added two link buttons, one for Editing and one for Deleting.But still, isn’t so fancy and moreover doesn’t support editing and updating records. The one for Editing has a Command Name attribute assigned to “Edit”.