protected void Page_Load(object sender, EventArgs e) { if (Session["UserId"] != null) { string userId = Session["UserId"].ToString(); } else { //If the session value for userid is not set, redirect the user to the loginpage //see the ReturnUrl querystring value, it will be the page, that the ASP.NEt //infrastructure will redirect to after successful validation of the user //See the <Authentication node in web.config FormsAuthentication.RedirectToLoginPage(); } if (!IsPostBack) { Collection <CartProductCL> activeCarts = cartBLL.getProductsAddedInCart();//To be pending of added in cart.cartBLL.getAddedInCart() Collection <AddedInCartCL> activeCartDetails = ConvertCartToGrid(activeCarts); if (activeCartDetails.Count() > 0) { grdAddedInCart.DataSource = activeCartDetails; grdAddedInCart.DataBind(); } else { DataTable dt = new DataTable(); ShowNoResultFound(activeCartDetails, grdAddedInCart); } } }