Samuel Toh

Samuel Toh

  • NA
  • 106
  • 14.1k

Refresh Label from ASP.NET HTML

Nov 2 2021 6:49 AM

protected void btnSubmit_Click(object sender, EventArgs e)

{

Application["Summary"] = lblTotalSummary.Text;

}

protected void Button1_Click(object sender, EventArgs e)

{

if (Application["Summary"] != null)
        {
            string Name = Application["Summary"].ToString();
            lbliPhone12.Text = "iPhone 12 Series:<br>" + Name;
        }
        else if(Application["Summary"] == null)
        {
            return;
        }

}

 

So above is what I have used to transfer a label value output to another. However, everytime when I run the page again and click on "Button1". It shows the same output as the previous one. Is there any way where I can refresh the label output so that it has no value inside?


Answers (2)