如何从GridView中选择和写入记录 [英] How to select and write records from a GridView

查看:77
本文介绍了如何从GridView中选择和写入记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个愿望清单,用户将产品添加到其列表中以供将来使用。我使用GridView在用户登录购物车后显示记录。如何编程方法以便用户可以从愿望清单中选择项目并将其放入购物车?


请参阅附件!


谢谢!



I am working on a wish list where users add products to their list for future purhcases. I am using a GridView to display the records by users after they have login to the shopping cart. How can I program a method so that a user can select items from the wish list and have them placed in the shopping cart?

See Attachment!

Thank you!

附加图片
样本1.jpg (18.7 KB,202 views)
Attached Images
sample 1.jpg (18.7 KB, 202 views)

推荐答案

我有一个gridview,我将其用作心愿单,但我希望能够让用户将他们的愿望清单中的物品添加到各自的购物车中。我已经对用户登录进行了编程以提取相应用户的心愿单,并且我编写了一个按钮来删除不需要的项目。如何编写可由用户选择的复选框,然后让用户单击CheckOut按钮将这些项目和相关信息复制到购物车?


请参阅代码下面
I have a gridview that I am using as a wishlist, but I want to have the functionality of allowing users to add their items from their wishlist to their respective shopping cart. I have programmed the user login to pull up the respective user''s wishlist and I have programmed a button to remove unwanted items. How can I program a checkbox that can be selected by the user, then have the user click on the CheckOut button to copy those items and the associated information to the shopping cart?

See Code Below
展开 | 选择 | Wrap | 行号


你好Tsubasa,


我想我来了之前你的问题,但因为我不知道你用什么作为购物车我不知道回答你问题的好起点是什么。


既然你已经发布了你的代码,那就更清楚你是什么了我试着这么做但是我还没看到购物车。


什么是你的购物车?

这是一个存储在会话中的对象?

它是数据库中的表格吗?

还有别的吗?

你有购物车吗?


无论如何,我要建议的第一件事是为复选框添加一个ID,以便您可以使用FindControl方法找到它。


然后,当用户点击结账时,按钮,循环遍历GridView中的所有行,并检查是否选中了复选框....如果是,请执行将项目添加到此购物车所需的任何操作。


-Frinny
Hi Tsubasa,

I think I''ve come across your question before but because I didn''t know what you were using as a "Shopping Cart" I didn''t know what a good starting point for answering your question would be.

Now that you''ve posted your code it''s a Little more clear as to what you''re trying to do but I still don''t see a shopping cart.

What is your "Shopping Cart"?
Is it an Object stored in session?
Is it a table in a database?
Is it something else??
Do you even have a shopping cart?

Anyways, the first thing I''m going to suggest is adding a ID for the checkbox so that you can locate it using the FindControl method.

Then when the user clicks the "checkout" button, loop through all of the rows in the GridView and check if the checkbox is checked....if so, do whatever you need to do to add the item to this "shopping cart".

-Frinny


之前我确实遇到过这个问题。

我把问题合并在一起。

-Frinny
I did run across this question before.
I''ve merged the questions together.

-Frinny


这篇关于如何从GridView中选择和写入记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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