I'm a PHP guy learning some .NET. I am tinkering around with the UpdatePanel control for a little dashboard.
In .aspx file, I'm using OnClick to trigger the code behind file to update the label by +1
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div id="Container">
<asp:UpdatePanel runat="server" ID="UpdatePanel1"
OnLoad="UpdatePanel1_Load">
<ContentTemplate>
<asp:Label ID="CounterOne" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="UpdatePanel1_Increment"/>
However, when I run it on localhost. It increments the first time I push the button, but each subsequent click does nothing.
Here is the CodeBehind:
public void UpdatePanel1_Increment(object sender, EventArgs e)
{
counter = counter + 1;
CounterOne.Text = counter.ToString();
}
Do I need to reset something on the control?
Thanks!
Note: I know there are more bandwidth friendly ways to do this, but I'm just testing out some ideas...