So I was making a page for creating accounts and saving them inside a database. To check if the code is working, I added debug messages between some lines of code using:
ScriptManager.RegisterStartupScript(this, GetType(),
"textas", "alert('test')", true);
The problem is that it turned out that having two debug messages will cause the page to not display any of them. I tested a simple code in an another page (shown below) and got the same problem. I also realized that showing one message will eventually make the code stop at where the debug message was, so any code that comes after won't run.
protected void test_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(),
"textas", "alert('test')", true);
ScriptManager.RegisterStartupScript(this, GetType(),
"textasd", "alert('test1')", true);
}
Am I missing something or is that some kind of bug?
Try adding semicolons to the end of the js statements.
ScriptManager.RegisterStartupScript(this, GetType(),
"textas", "alert('test');", true);
ScriptManager.RegisterStartupScript(this, GetType(),
"textasd", "alert('test1');", true);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments