ASP.NET - image button change when click. - Asked By msakt on 12-Jun-12 01:31 AM

i have two image for one button,default show one image if click show another image then click another button or refresh show default image
dipa ahuja replied to msakt on 12-Jun-12 03:57 AM
int i = 0;
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
      ImageButton1.ImageUrl = "images/2.jpg"; 
    }
  }
  private void button4_Click(object sender, EventArgs e)
  {
    if (i == 0)
    {
      ImageButton1.ImageUrl = "images/1.jpg";
      i = 1;
    }
    else
    {
      ImageButton1.ImageUrl = "images/2.jpg";
      i = 0;
    }
  }