Exemplo n.º 1
0
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            // left button
            int index = 0;

            if (Request.Cookies["imageindex"] == null)
            {
                dfimages = new defaultimages();
                HttpCookie cookie = new HttpCookie("imageindex");
                cookie.Value   = "0";
                cookie.Expires = DateTime.Now.AddDays(5);
                Response.Cookies.Add(cookie);
            }
            else
            {
                index  = int.Parse(Request.Cookies["imageindex"].Value);
                index += dfimages.ImgNum - 1;
                index %= dfimages.ImgNum;
                HttpCookie cookie = new HttpCookie("imageindex");
                cookie.Value   = index.ToString();
                cookie.Expires = DateTime.Now.AddDays(5);
                Response.Cookies.Add(cookie);
            }

            ImageMap1.ImageUrl = dfimages.getImage(index);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int index = 0;

            if (Request.Cookies["imageindex"] == null)
            {
                dfimages = new defaultimages();
                HttpCookie cookie = new HttpCookie("imageindex");
                cookie.Value   = "0";
                cookie.Expires = DateTime.Now.AddDays(5);
                Response.Cookies.Add(cookie);
            }
            else
            {
                index = int.Parse(Request.Cookies["imageindex"].Value);
            }
            ImageMap1.ImageUrl = dfimages.getImage(index);
        }