Solved

Accessing dataset changes bound to gridview

Posted on 2013-10-24
1
544 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
[X]
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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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