protected void addtofav(object sender, EventArgs e)
        {
            var button       = sender as Button;
            var dataListItem = button.Parent as DataListItem;
            var fvbtn        = dataListItem.FindControl("fvbtn") as Button;

            if (fvbtn.Text == "Add to Favourites")
            {
                string s      = Session["User"].ToString();
                string bid    = Request.Cookies["bkid"].Value.ToString();
                int    bookid = Int16.Parse(bid);
                bl.addtoFavourites(s, bookid);

                fvbtn.Text = "Remove From Favourites";
            }
            else
            {
                string s      = Session["User"].ToString();
                string bid    = Request.Cookies["bkid"].Value.ToString();
                int    bookid = Int16.Parse(bid);
                bl.removefromfavourites(s, bookid);

                fvbtn.Text = "Add to Favourites";
            }
        }
예제 #2
0
        protected void addtofav(object sender, EventArgs e)
        {
            if (favbtn.Text == "Add to Favourites")
            {
                string s      = Session["User"].ToString();
                string bid    = Request.Cookies["bkid"].Value.ToString();
                int    bookid = Int16.Parse(bid);

                b.addtoFavourites(s, bookid);
                favbtn.Text = "Remove From Favourites";
            }
            else
            {
                string s      = Session["User"].ToString();
                string bid    = Request.Cookies["bkid"].Value.ToString();
                int    bookid = Int16.Parse(bid);
                b.removefromfavourites(s, bookid);
                favbtn.Text = "Add to Favourites";
            }
        }