Here is my problem: I have a small table to display in a gridview. The user needs to be able to edit any or all of the rows and save the data back to the database. I only want the user to have to click one update button for all the rows to update at once.
Here is the code to bind the gridview to the appropriate data:
_con = New SqlConnection(_myConString)
_da = New SqlDataAdapter(_mySelectString", _con)
_ds = New DataSet
dgrTest.DataSource = _ds
dgrTest.DataMember = "NOT"
The gridview populates nicely. Here is the code that executes when the user clicks the update button:
Dim _cmb As New SqlCommandBuilder(_da)
The problem is that a postback occurs when the update button is clicked, so my dataset becomes nothing as soon as that happens and the update fails because there is no table at index 0 of my dataset.
I tried storing the dataset in a session variable right after binding it to the gridview and retrieving it when a postback occurs, but that just sets it back to the way it was before the user changed any rows, so the update succeeds but doesn't change any data.
I hope I've explained this sufficiently to give you an idea of my problem. Thanks in advance for any help.
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Thanks for the speedy reply. The page you directed me to was good info and I made a note of it for future use. I was hoping for a little simpler solution, though. Any ideas?
By timmym in forum ASP.NET
Last Post: 11-23-2008, 08:31 AM
By Fafeman in forum ASP.NET
Last Post: 05-02-2007, 01:58 PM
By fowlerlfc in forum ASP.NET
Last Post: 04-02-2007, 11:39 AM
By alphaoide in forum ASP.NET
Last Post: 07-31-2006, 12:07 PM
By mycwcgr in forum ASP.NET
Last Post: 10-11-2005, 09:13 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center