0
I have a question in ASP.NET, I am creating a loop of repetition inside the HTML so that appear 60 buttons, each with a different number in Text, going from 0 to 59, and then I need to take this text and put in a textbox. I was doing it the way down:
<%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 turns out that when in the event "Button3_click" I do the code below, the textbox gets value 0.
protected void Button3_Click(object sender, EventArgs e)
{
tbAssento.Text = Button1.Text;
}
I’ve also tried declaring a public variable that gets the value of i and sends to the textbox but also doesn’t work. What I do?