Quote:
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("Response.Redirect('WebForm2.aspx'){");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
Apart from the obvious syntax error, you're also trying to invoke a server-side method (
Response.Redirect
) from client-side code.
Replace the content of your event handler with:
protected void btnMsg_Click(object sender, EventArgs e)
{
Response.Redirect("WebForm2.aspx");
}
Quote:
i want to use the server side confirm not client side
There is no "server-side confirm". Code running on the server cannot display any UI to the client, except by returning content in the response. The only way to display a message to the user is via client-side code.