Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

When user want to add product in cart and click on add to cart link button than it's display select size first so how i can do it

my code for add to cart:

XML
<asp:LinkButton ID="linkAddtocart" runat="server"  oncommand="BuyNow_Command"
               CommandArgument='<%#Eval("Product_ID") %>'>Add To Cart</asp:LinkButton>


C#
protected void BuyNow_Command(object sender, CommandEventArgs e)
   {

       string str = "";
       if (Session["ProductID"] == null)
       {
           str = e.CommandArgument.ToString();
           Session["ProductID"] = str + "|";
       }
       else
       {
           str = Session["ProductID"].ToString();
           str = str + e.CommandArgument.ToString() + "|";
           Session["ProductID"] = str;
       }

       Label1.Text = str;

   }

and lable and it's value of sizes:

VB
<asp:Label
               ID="lblSize"
               runat="server"
               Text="Select Size :"></asp:Label>

               <asp:RadioButton ID="RadioButton1" GroupName="Size" runat="server" Text="Small"
               oncheckedchanged="RadioButton1_CheckedChanged" />
               <asp:RadioButton ID="RadioButton2" GroupName="Size" runat="server"
               Text="Medium" oncheckedchanged="RadioButton2_CheckedChanged" />
               <asp:RadioButton ID="RadioButton3" GroupName="Size" runat="server"
                Text="Large" oncheckedchanged="RadioButton3_CheckedChanged" />
               <asp:RadioButton ID="RadioButton4" GroupName="Size" runat="server"
                Text="XL" oncheckedchanged="RadioButton4_CheckedChanged" />
               <asp:RadioButton ID="RadioButton5" GroupName="Size" runat="server"
                Text="XXL" oncheckedchanged="RadioButton5_CheckedChanged" />
               <asp:RadioButton ID="RadioButton6" GroupName="Size" runat="server"
                Text="XS" oncheckedchanged="RadioButton6_CheckedChanged" />
Posted
Updated 22-May-13 2:23am
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900