Click here to Skip to main content
15,994,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello

My Code

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
RadioButton rb1 = null;
RadioButton rb2 = null;
RadioButton rb3 = null;
RadioButton rb4 = null;
RadioButton rb5 = null;
RadioButton rb6 = null;


foreach (DataListItem item in dlDisplayAll.Items)
{
rb1 = (RadioButton)item.FindControl("RadioButton1");
rb2 = (RadioButton)item.FindControl("RadioButton2");
rb3 = (RadioButton)item.FindControl("RadioButton3");
rb4 = (RadioButton)item.FindControl("RadioButton4");
rb5 = (RadioButton)item.FindControl("RadioButton5");
rb6 = (RadioButton)item.FindControl("RadioButton6");

if (rb1.Checked == true)
{
Session["Size"] = "Small";
}
else if (rb2.Checked == true)
{
Session["Size"] = "Medium";
}
else if (rb3.Checked == true)
{
Session["Size"] = "Large";
}
else if (rb4.Checked == true)
{
Session["Size"] = "XL";
}
else if (rb5.Checked == true)
{
Session["Size"] = "XXL";
}
else if (rb6.Checked == true)
{
Session["Size"] = "XS";
}
}
}

and in viewcart.cs file

str11 += "
<input type='Text' id='size" + cnt1 + "' value=" + Session["Size"].ToString() +" readonly>
";

now when i add one item in cart it display all information with size id etc. now i continue shopping and add new item in cart than size of both item gone same because i used Session[Size] one session now how i can do size with it's product id
Posted

1 solution

You can pass nearly anything as a session variable, under only one condition: the object should be serializeable. Isn't this logical?

This is well explained here: http://msdn.microsoft.com/en-us/library/ms178581%28v=vs.100%29.aspx[^].

—SA
 
Share this answer
 
Comments
Member 9815058 18-May-13 7:03am    
I can't Understand
Sergey Alexandrovich Kryukov 18-May-13 21:48pm    
What, even after reading referenced MSDN articles? Did you try to read them? You should be familiar with serialization, once you deal with session variables. Are you not? Then learn it.
—SA

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