Poll results incremented by one with every refresh

Mar 23, 2009 at 9:09 AM
Edited May 6, 2009 at 6:01 AM

resolved
Sep 21, 2009 at 3:19 PM

Hi Srikanth,

I have same problem with Poll webpart, please let me know how it is resolved. is there any specific settings needs to change?

thanks,

Sep 24, 2009 at 5:25 AM

Kpmani,

Include a condition to check if cookie exists in the button click, as marked in red........

private void ButtonSubmit_Click(object sender, System.EventArgs e)
  {
   try
   {
                if (HttpContext.Current.Request.Cookies[cookieName] == null)
                {
                    HttpCookie cookie = new HttpCookie(cookieName);
                    cookie.Value = "true";                   
                    cookie.Expires = DateTime.Now.AddDays(cookieExpires);
                    HttpContext.Current.Response.Cookies.Add(cookie);
                    updatePollList();                   
                }
   }
   catch (Exception ex)
   {
    string error = ex.ToString();
    error += "2";
    //output.WriteLine("ERROR RenderWebpart: " + ex.Message);
   }
  }

srikanth.

Sep 24, 2009 at 5:38 AM

Thanks for the response srikanth.

Cheers.

Mar 22, 2010 at 10:01 PM

Is this the only way to fix this issue by chaging the code ?

 

Jun 8, 2010 at 5:40 PM

Sweet... that works like a charm.