I have a GridView sitting on an ASP.NET web form page using simple update button. You click on the update, can change the data in the fields, then when you click the 'Update' link provided by the control The method which I had constructed and tested doesn't seem to be activated at all.
I built a sub to try and drive this and control the process a bit more, then got off into the woods trying to fix the sub to work. I got the sub working fine but on doing that I found that even though I had a sub working that triggered off the update button in edit mode from the gridview and could verify that the data was there... AND... even went so far as to add code to the sub to initiate what should have been an unnecessary call to update the record, nothing is getting written to the table from the edit.
As I had this working perfectly at one point and then a formatting glitch messed it up I suspect that something has changed in a parameter setting that is inhibiting the update and simply needs to be switch off. I'll post below what I would think was the pertinent information but if you believe there is other information that would be helpful in you helping me please let me know and I will get it to you. Really want this gone from my project list, its been a pain.
Note that the Update Method is using in this example the session variable "DocID" to find the correct record to update. But I've used current index as well for testing with the same results this is simply the current version. I Have no preference either way.
The SQLDataSource reads as:
Quote:
<asp:SqlDataSource ID="GapDocDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ARFSConnectionString %>" SelectCommand="SELECT [DocID], [DElement_Sub], [Doc_Name], [ENote], [Doc_Section], [Windows_C], [Windows_G], [Windows_U], [UNIX], [Mainframe], [IDS_IPS], [Network], [Other], [NotApply] FROM [GETT_DocGaps] WHERE ([ARSDocTag] = @ARSDocTag)"
DeleteCommand="DELETE FROM GETT_DocGaps WHERE (DocID= @DocID) "
InsertCommand="INSERT INTO GETT_DocGaps(ARSDocTag, DElement_Sub, Doc_Name, ENote, Doc_Section, Windows_C, Windows_G, Windows_U, UNIX, Mainframe, IDS_IPS, Network, Other, NotApply) VALUES (@ARSDocTag, @DElement_Sub, @Doc_Name, @ENote, @Doc_Section, @Windows_C, @Windows_G, @Windows_U, @UNIX, @Mainframe, @IDS_IPS, @Network, @Other, @NotApply)"
UpdateCommand="UPDATE GETT_DocGaps SET Doc_Name = @Doc_Name, ENote = @ENote, Doc_Section = @Doc_Section, Windows_C = @Windows_C, Windows_G = @Windows_G, Windows_U = @Windows_U, UNIX = @UNIX, Mainframe = @Mainframe, IDS_IPS = @IDS_IPS, Network = @Network, Other = @Other, NotApply = @NotApply WHERE (DocID = @DocID)" ViewStateMode="Enabled">
<deleteparameters>
<asp:Parameter Name="DElement_Sub">
<asp:Parameter Name="ARSDocTag">
<insertparameters>
<asp:Parameter Name="ARSDocTag">
<asp:Parameter Name="DElement_Sub">
<asp:Parameter Name="Doc_Name">
<SelectParameters>
<asp:SessionParameter Name="ARSDocTag" SessionField="ArticleFocus" Type="String" />
</SelectParameters>
<updateparameters>
<asp:SessionParameter Name="Doc_Name" SessionField="DocID" />
<asp:Parameter Name="ENote">
<asp:Parameter Name="Doc_Section">
<asp:Parameter Name="Windows_C">
<asp:Parameter Name="Windows_G">
<asp:Parameter Name="Windows_U">
<asp:Parameter Name="UNIX">
<asp:Parameter Name="Mainframe">
<asp:Parameter Name="IDS_IPS">
<asp:Parameter Name="Network">
<asp:Parameter Name="Other">
<asp:Parameter Name="NotApply">
<asp:Parameter Name="DocID">
Then there is the Sub that handle the process when the update button is clicked during an edit. This shouldn't be needed but I added it just to give me a bit more control and let me see what was going on. This works but doesn't really help at all:
Protected Sub GridView1_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Try
Dim row As GridViewRow = GridView1.Rows(e.RowIndex) 'Get the edit row
ident = row.Cells(3).Text 'Get the value. you could set a breakpoint to check the value.
Session("DocId") = ident 'Save value in session
'GapDocDataSource.Update() There is no need to call SqlDatabase update Method here
Catch
End Try
End Sub
As I said, if you feel screen shots or any other information would be helpful in you helping me let me know and I will do what I can to getting it to you but there are no errors popping up here. It simply is not writing the updates to the database.
Thanks and regards,
Ken...