protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["User"] == null) { Response.Redirect("Register.aspx"); } User user = (User)Session["User"]; currentUser.InnerText = user.LastName; currentUser.Attributes.Remove("href"); currentUser.Attributes.Add("href", "CustomerInformation.aspx"); List <Cart> lstCart = db.Carts.Where(n => n.CustomerID == user.UserID).ToList(); List <CartViewModel> lstCartVM = CartViewModel.CreateList(lstCart); gvCarts.DataSource = lstCartVM; gvCarts.DataBind(); } }