Here i have created sample that fullfill your requirement.
HTML
Default.aspx
<head runat="server">
<title></title>
<style type="text/css">
h1
{
color: blue;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>
Get The Best Deal On - Line</h1>
<hr />
<br />
<asp:Label ID="Label1" runat="server" ForeColor="#FF0066" Height="30px"></asp:Label>
<br />
<br />
<asp:Panel ID="Panel1" runat="server">
<asp:CheckBox ID="CheckBox1" runat="server" Text="Coffee" />
<br />
<br />
<asp:CheckBox ID="CheckBox2" runat="server" Text="Tea" />
<br />
<br />
<asp:CheckBox ID="CheckBox3" runat="server" Text="Cappuccino" />
<br />
<br />
<hr />
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="Add to cart" OnClick="Button1_Click"
Height="48px" Width="138px" />
<br />
<br />
<br />
</div>
<p>
<asp:Button ID="Button2" runat="server" Text="Check Out" OnClick="Button2_Click"
Style="height: 35px" />
</p>
</form>
</body>
Page2.aspx
<head runat="server">
<title></title>
<style type="text/css">
h1
{
color: blue;
}
table, th
{
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>
Get The Best Deal On - Line</h1>
<hr />
<br />
<table style="width: 30%">
<tr>
<td>
<b>Coffee</b>
</td>
<td>
<asp:Label ID="lblCoffee" runat="server" Text="0" />
</td>
</tr>
<tr>
<td>
<b>Tea</b>
</td>
<td>
<asp:Label ID="lblTea" runat="server" Text="0" />
</td>
</tr>
<tr>
<td>
<b>Cappuccino</b>
</td>
<td>
<asp:Label ID="lblCappuccino" runat="server" Text="0" />
</td>
</tr>
</table>
<br />
<hr />
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Back to the shop</asp:LinkButton>
</div>
</form>
</body>
Code
Default.aspx
protected void Button1_Click(object sender, EventArgs e)
{
int count = 0;
foreach (Control c in Panel1.Controls)
{
if (c is CheckBox && (c as CheckBox).Checked)
{
count++;
}
}
Label1.Text = "There are " + count + " items in your cart";
}
protected void Button2_Click(object sender, EventArgs e)
{
string checkedItems = string.Empty;
foreach (Control control in Panel1.Controls)
{
if (control is CheckBox && (control as CheckBox).Checked)
{
checkedItems += (control as CheckBox).Text + ",";
}
}
Response.Redirect("Page2.aspx?checkedItems=" + checkedItems);
}
Page2.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] checkedItems = Request.QueryString["checkedItems"].Split(',');
foreach (string item in checkedItems)
{
if (item.ToLower() == "coffee")
{
lblCoffee.Text = "1";
}
else if (item.ToLower() == "tea")
{
lblTea.Text = "1";
}
else if (item.ToLower() == "cappuccino")
{
lblCappuccino.Text = "1";
}
}
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
Screenshot
