Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Accessing dataset changes bound to gridview

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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.

856 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