gridview help
<p>Step 1:- Click on more
<img src="http://i.stack.imgur.com/jzxQy.jpg" alt="enter image description here"></p>

<p>Step 2:- Click on add to cart to add an item to cart
<img src="http://i.stack.imgur.com/0E1vY.jpg" alt="enter image description here"></p>

<p>This is my gridview</p>

<pre><code>&lt;asp:GridView ID="GridView1" runat="server" 
                                                   AllowSorting="True" 
                                                   AutoGenerateColumns="False" 
                                                   CellPadding="4"      
                                                   ForeColor="#333333" 
                                                   GridLines="None" 
                                                   Width="810px" 
                                                   CssClass="gridview"                               
                                                   DataSourceID="SqlDataSource3" &gt;
                      &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
                      &lt;Columns&gt;
                      &lt;asp:TemplateField ShowHeader="False"&gt;
                            &lt;ItemTemplate&gt;
                                &lt;asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit"&gt;More...&lt;/asp:LinkButton&gt;
                            &lt;/ItemTemplate&gt;
                            &lt;EditItemTemplate&gt;
                                &lt;asp:LinkButton ID="GVAddToCart" runat="server" onclick="GVAddToCart_Click"&gt;Add to cart&lt;/asp:LinkButton&gt;
                            &lt;/EditItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="itemName" SortExpression="itemName"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("itemName") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="itemName" runat="server" Text='&lt;%# Eval("itemName") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="price" SortExpression="price"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("price") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="price" runat="server" Text='&lt;%# Eval("price") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="offer" SortExpression="offer"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label3" runat="server" Text='&lt;%# Bind("offer") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="offer" runat="server" Text='&lt;%# Eval("offer") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="availability" SortExpression="availability"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label4" runat="server" Text='&lt;%# Bind("availability") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="availability" runat="server" Text='&lt;%# Eval("availability") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="shopName" SortExpression="shopName"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label5" runat="server" Text='&lt;%# Bind("shopName") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="shopName" runat="server" Text='&lt;%# Eval("shopName") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="address" SortExpression="address"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label6" runat="server" Text='&lt;%# Bind("address") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="address" runat="server" Text='&lt;%# Eval("address") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="email" SortExpression="email"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label7" runat="server" Text='&lt;%# Bind("email") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="email" runat="server" Text='&lt;%# Eval("email") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;asp:TemplateField HeaderText="phone" SortExpression="phone"&gt;
                        &lt;ItemTemplate&gt;
                            &lt;asp:Label ID="Label8" runat="server" Text='&lt;%# Bind("phone") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/ItemTemplate&gt;
                        &lt;EditItemTemplate&gt;
                            &lt;asp:Label ID="phone" runat="server" Text='&lt;%# Eval("phone") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;/EditItemTemplate&gt;
                    &lt;/asp:TemplateField&gt;
                    &lt;/Columns&gt;
    &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
    &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
    &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
    &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
    &lt;EditRowStyle BackColor="#999999" /&gt;
    &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
    &lt;/asp:GridView&gt;

    &lt;asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                                           ConnectionString="&lt;%$ ConnectionStrings:databaseConnectionString %&gt;" 
                                           SelectCommand="SELECT shopList.itemName, shopList.offer, shopList.price, shopList.availability, shopDescription.shopName, shopDescription.address, shopDescription.email, shopDescription.phone FROM shopList INNER JOIN shopDescription ON shopList.shopID = shopDescription.shopID"&gt;
    &lt;/asp:SqlDataSource&gt;
</code></pre>

<p>This is the code behind for the add to cart link button</p>

<pre><code>Protected Sub GVAddToCart_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        If User.Identity.Name = "" Then
            MsgBox("You need to login first before adding anything to the cart!", , "")
            Response.Redirect("~/login.aspx", True)
            Exit Sub
        End If

        Dim sCart = New cart
        Dim itemName, GVPrice, offer As Label
        Dim userID, buyNo, itemID As String

        itemID = Request.QueryString("itemID")
        itemName = CType(ListView1.Items(0).FindControl("itemName"), Label)
        userID = User.Identity.Name

        Dim index As Integer = GridView1.EditIndex
        GVPrice = CType(GridView1.Rows(index).FindControl("price"), Label)
        GVPrice.Text = CType(GVPrice.Text, Integer)
        offer = CType(GridView1.Rows(index).FindControl("offer"), Label)

        If sCart.CheckIfItemPresent(userID, itemID, GVPrice.Text, offer.Text) = True Then
            Exit Sub
        End If

        buyNo = sCart.findLatestBuyNo(userID)
        Session("buyNo") = buyNo

        Session("buyNo") = sCart.AddToCart(itemID, itemName.Text, GVPrice.Text, offer.Text, buyNo, userID)
    End Sub
</code></pre>

<p>so what i want to do is to remove the Step 1..how can i do this??if i remove the more link..it stops working...please help me.
i have to click on the more link to to get the Add to cart link...i want to add an item to the cart in one click..with what i have now ...i need two clicks.
when i click on more it goes to edit mode..then when i click on add to cart(which is in edit template)..it takes the price and offer values from the edit template..if i move the "Add To Cart" button into the ItemTemplate...it cant access the offer and price values. if i move the "Add To Cart" button into the ItemTemplate how will i know which row is being clicked???</p>
