Online Polling

02/06/2009 16:04

 static int count = 0;
  static decimal countA = 0;
  static decimal countB = 0;
  decimal perA = 0;
  decimal perB = 0;


  protected void LinkButton1_Click(object sender, EventArgs e)
  {
  lblA.BackColor = Color.Blue;
  //widthA = Convert.ToInt32(lblA.Width.Value);

  count += 1;
  countA += 1;

  calA();
  calB();
  }


  protected void LinkButton2_Click(object sender, EventArgs e)
  {

  lblB.BackColor = Color.Red;
  //widthB = Convert.ToInt32(lblB.Width.Value);
  count += 1;
  countB += 1;
  calB();
  calA();
  }

  void calB()
  {
  perB = (countB / count) * 100;

  lblB.Text =Convert.ToInt32(perB).ToString() + "%";
  lblB.Width = Convert.ToInt32(perB) * 4 * 1;
  }

  void calA()
  {
  perA = (countA / count) * 100;

  lblA.Text =Convert.ToInt32(perA).ToString() + "%";
  lblA.Width = Convert.ToInt32(perA) * 4 * 1;
  }
 

Contact

M. Jeyachandran @ M.Jayaramchandran 9840923422 jayaramchandran.m@gmail.com