从gridview删除行时出现问题 [英] problem while delete row from gridview

查看:119
本文介绍了从gridview删除行时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi ..
我正在使用gridview控件.我想删除删除链接按钮上的特定行.我通过AutoGenerateDeleteButton = true获得的链接按钮.我在删除按钮上添加了grvJV_RowDeleting方法.有时它没有可用的源代码.

我的代码是

hi..
I am using gridview control.i want to delete particular row on delete linkbutton.this link button i got by AutoGenerateDeleteButton=true.i am adding grvJV_RowDeleting method on delete button click it not works.function call infinite time some time it gaves stack overflow error some times it gives no source code available.

my code is

Private Sub grvJV_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles grvJV.RowDeleting
       
        Dim dt As DataTable
        dt = ViewState("CurrentTable")
        dt.Rows.RemoveAt(e.RowIndex)
        ViewState("CurrentTable") = dt
      
        grvJV.DeleteRow(e.rowindex)
    End Sub

推荐答案

据我了解,
位于末尾的grvJV.DeleteRow(e.rowindex)以递归方式再次调用该函数.
另外,我看不到任何删除此处记录的代码.
网格视图仅向您提供"e" eventArgs来获取您单击的行的信息.进一步删除行的过程应通过对数据库进行适当的查询来通过代码执行.
Hi, As per my understanding,
grvJV.DeleteRow(e.rowindex) placed before the end is calling the function again in a recursive way.
Plus I cannot see any code for deleting a record written over here.
The grid view just gives you the ''e'' eventArgs to fetch the information of the row you have clicked on.Further process of deleting the row should be performed through code by firing appropriate query to the database.



请通过下面的链接:
带有确认的GridView删除 [ http://devilswork.wordpress.com/2009/03/27 /gridview-row-edit-delete-and-update/ [ http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdeleting.aspx [ http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.deleterow.aspx [
Hi,
Please go through the links bellow:
GridView Delete, with Confirmation[^]
http://devilswork.wordpress.com/2009/03/27/gridview-row-edit-delete-and-update/[^]
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdeleting.aspx[^]
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.deleterow.aspx[^]
All the best.
--Amit


请参阅以下链接....

使用Gridview插入,更新,删除....简单方式 [ ^ ]
Refer Following link....

Insert, Update, Delete with Gridview....simple way[^]


这篇关于从gridview删除行时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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