【问题标题】:how to implement the add the add to cart in grid view?如何在网格视图中实现添加到购物车?
【发布时间】:2011-04-15 07:41:43
【问题描述】:

我正在尝试制作购物门户。我想针对所有网格视图行添加添加到购物车。 如何在网格视图中添加此列? 以及如何在数据表中存储适当的添加到购物车值以临时存储数据的代码?

【问题讨论】:

    标签: c# asp.net gridview


    【解决方案1】:

    添加一个模板列,如..

    <asp:TemplateField>
        <ItemTemplate>
         <asp:Button ID="Button1" runat="server" Text="Add Cart" CommandName="ShoppingCart" />
        </ItemTemplate>
    </asp:TemplateField>
    

    然后处理Row命令事件,你会得到:

    protected void gdvSearchResults_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "ShoppingCart")
        {
            //AddedControl here in Session Data table 
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-12-19
      • 1970-01-01
      • 2011-10-15
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多