I am having a question in ASP.NET, I am creating a loop of repetition inside the HTML so that 60 buttons appear, each with a different number in the Text, going from 0 to 59, and then I need to get that text and put it in a textbox. I was doing it as below:
<%for (int i = 0; i < 60; i++)
{%>
<asp:Button ID="Button1" runat="server" Text="0" OnClick="Button3_Click" />
<% Button1.Text = (i + 1).ToString();
}%>
But it happens that when in the "Button3_Click" event I make the code below, the textbox gets value 0.
protected void Button3_Click(object sender, EventArgs e)
{
tbAssento.Text = Button1.Text;
}
I've also tried to declare a public variable that receives the value of i and sends it to the textbox but does not work either. What do I do?