Solved

Accessing dataset changes bound to gridview

Posted on 2013-10-24
1
538 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 27

Accepted Solution

by:
Ark earned 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now