GridView更新激活否,没有更新,没有线索 [英] GridView Update Fires No, No Update, No Clue

查看:75
本文介绍了GridView更新激活否,没有更新,没有线索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用简单的更新按钮将GridView放在ASP.NET Web表单页面上。您单击更新,可以更改字段中的数据,然后单击控件提供的更新链接时,我构建和测试的方法似乎根本没有被激活。



我建造了一个子试图驱动它并控制进程多一点,然后下台试图修复子工作。我得到了子工作正常,但在这样做,我发现,即使我有一个子工作,从gridview触发编辑模式下的更新按钮,并可以验证数据是否在那里...和...甚至去了为了向sub添加代码以启动应该更新记录的不必要的调用,从编辑中没有任何东西被写入表格。



As我有一个完美的工作在一点,然后格式化故障搞砸了我怀疑在参数设置中的某些东西已经改变,这阻止了更新,只需要关闭。我将在下面发布我认为的相关信息,但如果您认为有其他信息可以帮助我,请告诉我,我会告诉您。真的希望这从我的项目列表中消失,这很痛苦。



请注意,更新方法在此示例中使用会话变量DocID来查找正确的记录更新。但我也使用当前索引进行测试,结果相同,这只是当前版本。无论如何我都没有偏好。



SQLDataSource读作:

引用:

< asp:SqlDataSource ID =GapDocDataSourcerunat =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 = @DIDID)

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,@ DOM_Sub,@ Doc_Name,@ ENote,@ Doc_Section,@ Windows_C,@ Windows_G,@ Windows_U,@ UNIX,@ Mainframe,@ AIDS_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 = @其他,NotApply = @NotApply WHERE(DocID = @DIDID) ViewStateMode =已启用>

< deleteparameters>

< asp:参数名称=DElement_Sub>

< asp :参数名称=ARSDocTag>



< insertparameters>

< asp:参数名称=ARSDocTag>

< asp:参数名称=DElement_Sub>

< asp:参数名称=Doc_Name>



< SelectParameters>

< asp:SessionParameter Name =ARSDocTagSessionField =ArticleFocusType =String/>

< / SelectParameters>

< updateparameters>

< asp:SessionParameter Name =Doc_NameSessionField =DocID/>

< ; asp:参数名称=ENote>

< asp:参数名称=Doc_Section>

< asp:参数名称=Windows_C> ;

< asp:参数名称=Windows_G>

< asp:参数名称=Windows_U>

< asp:参数名称= UNIX>

< asp:参数名称=大型机>

< asp:参数名称=IDS_IPS>

< asp:参数名称=网络>

< asp:参数名称=其他>

< asp:参数名称= NotApply>

< asp:参数名称=DocID>









然后在编辑过程中单击更新按钮时会有Sub处理该过程。这不应该是需要的,但我添加它只是为了让我更多的控制,让我看看发生了什么。这有效但根本没有帮助:

受保护的子GridView1_RowUpdating(发件人为对象,e作为GridViewUpdateEventArgs)处理GridView1.RowUpdating 

尝试
Dim row As GridViewRow = GridView1.Rows(e.RowIndex)' 获取编辑行
ident = row.Cells(3).Text'
获取。您可以设置断点来检查
Session( DocId)= ident ' 在会话中保存价值

'
GapDocDataSource.Update()无需调用SqlDatabase更新方法此处

Catch

结束尝试
结束子







正如我所说,如果您觉得屏幕截图或任何其他信息对您帮助我告诉我有帮助,我会尽我所能来获取它对你而言,这里没有错误弹出。它只是没有将更新写入数据库。



谢谢和问候,

肯...

解决方案

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 = 删除GETT_DocGaps WHERE(DocID = @DIDID)

InsertCommand =INSERT INTO GETT_DocGaps(ARSDocTag,DElement_Sub,Doc_Name,ENote,Doc_Section,Windows_C,Windows_G,Windows_U,UNIX,Mainframe,IDS_IPS,Network ,其他,NotApply)VALUES(@ARSDocTag,@ DOM_Sub,@ Dot_Name,@ enote,@ Dot_Section,@ Wedows_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 =已启用>

< deleteparameters>

< asp:参数名称=DElement_Sub>

< asp:参数名称=ARSDocTag>



< insertparameters>

< asp:参数名称=ARSDocTag >

< asp:参数名称=DElement_Sub>

< asp:参数名称=Doc_Name>



< SelectParameters>

< asp:SessionParameter Name =ARSDocTagSessionField =ArticleFocusType =String/>

< / SelectParameters>

< updateparameters>

< asp:SessionParameter Name =Doc_NameSessio nField =DocID/>

< asp:参数名称=ENote>

< asp:参数名称=Doc_Section>

< asp:参数名称=Windows_C>

< asp:参数名称=Windows_G>

< asp:参数名称=Windows_U>

< asp:参数名称=UNIX>

< asp:参数名称=主机>

< asp:参数名称=IDS_IPS>

< asp:参数名称=网络>

< asp:参数名称=其他>

< asp:参数名称=NotApply>

< asp:参数名称=DocID>









然后有Sub处理在编辑期间单击更新按钮时进行处理。这不应该是需要的,但我添加它只是为了让我更多的控制,让我看看发生了什么。这有效但根本没有帮助:

受保护的子GridView1_RowUpdating(发件人为对象,e作为GridViewUpdateEventArgs)处理GridView1.RowUpdating 

尝试
Dim row As GridViewRow = GridView1.Rows(e.RowIndex)' 获取编辑行
ident = row.Cells(3).Text'
获取。您可以设置断点来检查
Session( DocId)= ident ' 在会话中保存价值

'
GapDocDataSource.Update()无需调用SqlDatabase更新方法此处

Catch

结束尝试
结束子







正如我所说,如果您觉得屏幕截图或任何其他信息对您帮助我告诉我有帮助,我会尽我所能来获取它对你而言,这里没有错误弹出。它只是没有将更新写入数据库。



谢谢和问候,

肯......

http:// csharp-video- tutorials.blogspot.in/2013/03/editing-and-updating-data-in-gridview.html [ ^ ]





尝试这个步骤


我将看看这个。目前的代码是在VB中,我宁愿把它放在那里,因为这是它开始的地方,但我没有看到任何理由为什么这个过程不适用于VB和C#。我将在接下来的一个小时内到达这里进行探索。



尽管如此,如果要执行此操作并非100%明确在调试期间与否,但我会在首先尝试之前返回并查看它。谢谢你,这比我约会还要多。



问候,

肯......

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...

解决方案

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...


http://csharp-video-tutorials.blogspot.in/2013/03/editing-and-updating-data-in-gridview.html[^]


try this steps


I will take a look at this. The code presently is in VB and I would prefer to leave it there as that is where it was to begin with but I don't see any reason why this process wouldn't work with VB as well as C#. I'll be getting to it here in a next hour or so to explore it.

Reading though this it wasn't 100% clear if this was to be performed during Debug or not, but I'll go back and review it prior to attempting it first. Thank you, it is more to go on than I've had to date.

Regards,
Ken...


这篇关于GridView更新激活否,没有更新,没有线索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆