从购物车中删除行 [英] delete row from shopping cart
问题描述
您好,
我在购物车页面中选择了多个产品后,试图从购物车中的表格中删除一行。产品通过会话保存到数据库中。
我创建了删除按钮,但它们无法正常工作。任何人都可以建议我应该做些什么来使它工作。
这是在表格单元格的每一行中添加删除按钮的正确方法吗?
cell = new TableCell();
cell = new TableCell();
Button btn = new Button();
btn.Text ="删除";
btn.Click + = new EventHandler(删除);
cell.Controls.Add(btn) ;
row.Cells.Add(单元格);
tblData.Rows.Add(row) ;
Hello,
I am trying to delete a row from the table in the shopping cart after selecting several products in the cart page. The products are saved into database through the session.
I have created the delete buttons but they are not working. Can anyone suggest what I should do to make it work.
Is this the right way to add delete button in each row of table cell?
cell = new TableCell();
cell = new TableCell();
Button btn = new Button();
btn.Text = "Delete";
btn.Click += new EventHandler(Delete);
cell.Controls.Add(btn);
row.Cells.Add(cell);
tblData.Rows.Add(row);
推荐答案
如果您正在使用tablecell而我建议使用ajax调用theough jQuery方法来删除产品。删除buttn也使用一些html元素,如图像或链接。
只需编写一个页面方法来删除产品并调用它进行ajax调用。
参考: -
1. http://www.jquery4u.com/function-demos/index.php?function=ajax [ ^ ]
2。这是php中的一个例子,但是也可以在.net中调用ajax ...: -
http://www.digitalbart.com/blog/simple-jquery-ajax-delete-with-confirmation/ [ ^ ]
If you are using tablecell rather i would suggest to make an ajax call theough jQuery methodsto delete product. The delete buttn also use some html element like image or link.
Just write a page method to delete the product and call it doing a ajax call.
Reference :-
1. http://www.jquery4u.com/function-demos/index.php?function=ajax[^]
2. This is an example in php but make ajax call same way in .net as well..:-
http://www.digitalbart.com/blog/simple-jquery-ajax-delete-with-confirmation/[^]
这篇关于从购物车中删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!