Solved

Accessing dataset changes bound to gridview

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

21 Experts available now in Live!

Get 1:1 Help Now