protected void lnkWishlist_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["userid"] != null)
            {
                if (Session["Tid"] == null)
                {
                    Random rd  = new Random();
                    string Tid = rd.Next().ToString();
                    Session["Tid"] = Tid;
                }
                DataTable  dt      = new DataTable();
                LinkButton btn     = (LinkButton)(sender);
                string     product = btn.CommandArgument;
                dt = local_cart.getDataFromProdtuct(product);
                if (dt.Rows.Count > 0)
                {
                    string  transid    = Session["Tid"].ToString();
                    Int32   productid  = Convert.ToInt32(dt.Rows[0]["ProductId"]);
                    decimal price      = Convert.ToDecimal(dt.Rows[0]["Price"]);
                    Int32   discount   = Convert.ToInt32(dt.Rows[0]["discountprice"]);
                    string  name       = Convert.ToString(dt.Rows[0]["Name"]);
                    string  thumbnail  = Convert.ToString(dt.Rows[0]["Thumbnail"]);
                    Int32   userid     = Convert.ToInt32(Session["userid"]);
                    string  usermobile = BindUserIdentify(Session["userid"].ToString());
                    int     result     = 0;

                    if (local_orderlist.IsWishlistExist(productid, transid, "N", "") == "F")
                    {
                        result = local_orderlist.AddNewWishlist(productid, transid, price, discount, name, thumbnail, userid, usermobile);

                        if (result != 0)
                        {
                            Response.Redirect("~/default.aspx", false);
                        }
                    }
                    else
                    {
                        mpe.Show();
                        lblpopup.Text = "You are already added to wishlist!";
                        //Response.Write("<script>alert('You are already added to wishlist!')</script>");
                    }
                }
            }
            else
            {
                mpe.Show();
                lblpopup.Text = "Please login and then add to wishlist.";
                //Response.Redirect("~/login.aspx", false);
            }
        }
        catch
        { }
    }
    protected void lnkWishlist_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["userid"] != null)
            {
                if (Session["Tid"] == null)
                {
                    Random rd  = new Random();
                    string Tid = rd.Next().ToString();
                    Session["Tid"] = Tid;
                }
                DataTable  dt      = new DataTable();
                LinkButton btn     = (LinkButton)(sender);
                string     product = btn.CommandArgument;
                dt = local_cart.getDataFromProdtuct(product);
                if (dt.Rows.Count > 0)
                {
                    string  transid    = Session["Tid"].ToString();
                    Int32   productid  = Convert.ToInt32(dt.Rows[0]["ProductId"]);
                    decimal price      = Convert.ToDecimal(dt.Rows[0]["Price"]);
                    Int32   discount   = Convert.ToInt32(dt.Rows[0]["discountprice"]);
                    string  name       = Convert.ToString(dt.Rows[0]["Name"]);
                    string  thumbnail  = Convert.ToString(dt.Rows[0]["Thumbnail"]);
                    Int32   userid     = Convert.ToInt32(Session["userid"]);
                    string  usermobile = BindUserIdentify(Session["userid"].ToString());

                    int result = 0;
                    if (local_orderlist.IsWishlistExist(productid, transid, "N", "") == "F")
                    {
                        result = local_orderlist.AddNewWishlist(productid, transid, price, discount, name, thumbnail, userid, usermobile);
                        if (result != 0)
                        {
                            string subcategoryid = Request.QueryString["subcategory"];
                            string categoryid    = Request.QueryString["category"];
                            string flavour       = Request.QueryString["Flavour"];
                            string brand         = Request.QueryString["Brand"];
                            if (subcategoryid != null)
                            {
                                Response.Redirect("~/product-list?subcategory=" + subcategoryid + "", false);
                            }
                            else if (categoryid != null)
                            {
                                Response.Redirect("~/product-list?category=" + categoryid + "", false);
                            }
                            else if (flavour != null)
                            {
                                Response.Redirect("~/product-list?Flavour=" + flavour + "", false);
                            }
                            else if (brand != null)
                            {
                                Response.Redirect("~/product-list?Brand=" + brand + "", false);
                            }
                            else
                            {
                                Response.Redirect("~/product-list.aspx", false);
                            }
                        }
                        else
                        {
                            Response.Write("<script>alert('You are already added to wishlist!')</script>");
                        }
                    }
                }
            }
            else
            {
                Response.Redirect("~/register.aspx", false);
            }
        }
        catch
        { }
    }