In my file named file.aspx.cs, I have the following function:
private void DisplayMessage(string text)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
"displayingMessage", $"alert('{text}')", true);
}
However, there seems to be an issue when I call this function multiple times consecutively. Only the first alert message appears on the screen. For example:
protected void ButtonClick(object sender, EventArgs e)
{
// click event for button
DisplayMessage("First message"); // visible on screen
DisplayMessage("Second message"); // not visible
}
I am curious as to why this behavior occurs. Any insights?