Gridview行删除中的问题 [英] Problem in Gridview Row Deletion
问题描述
大家好,
我正在尝试模拟购物车功能.我的可用产品显示在Products_Gridview中,该视图具有AddTOCart按钮.当按下此按钮时,它将使用较少的Product表中的列构建一个DataTable,并将其绑定到另一个gridview(Cart_Gridview).我也将此数据表存储在viewstate中,以供以后绑定.
现在的问题是我希望在Cart_GridView的每一行中都具有一个Remove按钮,该按钮可以从Cart_Gridview中删除相对行.我已经尝试了很多,但是无法从Cart_Gridview删除行.我还尝试从绑定了购物车gridview的数据表中删除行,但是在Cart_GridView_RowDeleting和Cart_GridView_RowCommad事件中,它在DataTable中显示了0行.
任何帮助将不胜感激.
在此先感谢
Hi all,
I am trying to simulate a shopping cart functionality. My available products are displaying in a Products_Gridview, which have a AddTOCart button. When this button is pressed it builds a DataTable with fewer columns from Product table and binds it to another gridview (Cart_Gridview). I store this datatable in viewstate also for later binding also.
Now the problem is that I want a Remove button in each row of Cart_GridView which could delete relative row from Cart_Gridview. I have tried a lot but could''nt delete row from Cart_Gridview. I also tried to delete row from data table from which cart gridview is bind but it shows 0 row in DataTable in Cart_GridView_RowDeleting and Cart_GridView_RowCommad Events.
any help will be greatly appreciated.
Thanks in advance
推荐答案
请参考以下主题:
带有确认的GridView删除 [删除GridView的基础数据 [全功能可编辑GridView控件 [ ^ ]
相同的视频:
如何使用GridView从数据库中删除行 [在gridview上删除按钮 [
Please refer following threads:
GridView Delete, with Confirmation[^]
Deleting a GridView''s Underlying Data[^]
This link give you complete information of Full-featured Editable GridView Control[^]
Videos on same:
How to delete a row from a database using the GridView[^]
Delete button on gridview[^]
感谢亲爱的回复.
我找到了解决方案.实际上,我忘记了从RowCommand的ViewState中获取Cart_GridView.终于我做到了.
感谢您审核...
Thanks for replying dear.
I found the solution. Actually I was forgetting to take Cart_GridView from ViewState in RowCommand. Finally I did it.
Thanks for reviewing...
这篇关于Gridview行删除中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!