How do I have a javascript popup showing a string? I declared a string:
string myString;
myString = "hello world!";
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message",
"window.alert('myString');", true);
}
But it shows myString instead of hello world!
Un oh you are using ‘mystring’ as a literal instead of using its Text value. Do it like this: