protected void cartadd_Click(object sender, EventArgs e)
{
Cart_table objta = new Cart_table();
string om = 0.ToString();
foreach (DataListItem li in dl1.Items)
{
CheckBox chked_item = (CheckBox)li.FindControl("chked_item");
if (chked_item != null)
{
if (chked_item.Checked==true)
{
int x = Convert.ToInt32(((Label)li.FindControl("Label1")).Text);
var movie = (from st in obj.Cart_tables
where st.username==Session["user"].ToString() && st.movie_id==x
select st.movie_id).SingleOrDefault();
if (x !=Convert.ToInt32(movie))
{
objta.movie_id = x;
objta.username = Session["user"].ToString();
obj.Cart_tables.InsertOnSubmit(objta);
obj.SubmitChanges();
}
}
}
}
}