Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Accessing dataset changes bound to gridview

Posted on 2013-10-24
1
Medium Priority
?
565 Views
Last Modified: 2013-10-25
I have a web page that has a gridview that I bind a dataset to.   Then I save the dataset to a session variable and start working with the gridview.  I update the gridviews columns with data.  Now I want to save these records to the database on the server.  So if I have to do anything with the dataset I have to use something like myds=ctype(session("ds"),dataset)
to use the dataset.  My question is while I am updating the rows on the grid is the underlying dataset actually being changed, and how can I update the dataset with the new information from the datagrid if it is not automatically updating.  Just confused on how to handle this.  I can either go through all the rows in the datagrid and find each control and get the data, or preferably just update the database with the current dataset.

thanks for the help
0
Comment
Question by:mgmhicks
1 Comment
 
LVL 28

Accepted Solution

by:
Ark earned 2000 total points
ID: 39599662
It depends on how you bind data. Just check
Private Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) Handles GridView1.RowUpdated
    Debug.Print(ctype(session("ds"),dataset).HasChages)
End Sub

Open in new window

If it has changes - update corresponding table
Using da As New SqlDataAdapter(...)
   da.update
End Using
If not - use e.NewValues to update table manually
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question