【发布时间】:2011-03-12 04:56:52
【问题描述】:
每当用户单击“添加到购物车”时,我都会将用户在“找到的项目”网格(屏幕截图的左侧)中选择的那些行添加到“已选择的项目”网格(屏幕截图的右侧)按钮。
屏幕截图:link http://img856.imageshack.us/img856/3015/datagridview.jpg。
搜索按钮从搜索服务中提供图书列表。 我在作为 DataGridView 的 itemsFoundList 中显示。
private void searchButton_Click( object sender, EventArgs e )
{
itemsFoundList.Columns.Clear ();
string[] list = searchServiceClient.BookSearch ( getBookName.Text, getAuthorName.Text );
itemsFoundList.Columns.Add ( "Items", "Items found:" );
displayToGrid ( itemsFoundList, list );
}
现在我不知道如何将选定的行添加到 cartList(这是一个 DataGridView)。
private void addToCart_Click( object sender, EventArgs e ) {
//I am not getting what to write here.
}
【问题讨论】:
-
您可以控制 searchServiceClient 吗?还是第三方维护的服务?
-
除了您现在返回的信息之外,假设您可能还有一个 BookID 或另一个可以返回的唯一标识符是否安全?
-
是的。如果您愿意,我们可以返回唯一标识符。但是这有什么关系呢?我只希望用户选择的那些行能够显示在另一个网格中。
标签: c# winforms datagridview