I have an array that I declare above my form load:
protected string[] Colors = new string [3] {\"red\", \"green\", \"orange\"};
When I clic
You have to store the number of clicks in your ViewState and increase it by one in your button's click event handler.
private int NumberOfClicks
{
get { return (int)(ViewState["NumberOfClicks"] ?? 0 );
set { ViewState["NumberOfClicks"] = value; }
}
protected void btn_Click(object sender, EventArgs e)
{
if(NumberOfClicks < colorArray.Length)
{
//write to response colorArray[NumberOfClicks];
NumberOfClicks += 1;
}
}