I\'m using vs 2010. I need to display the message to user and redirect the page.
I use the below line.
ScriptManager.RegisterStartupScript(this, this
If you want to put in .CS file, just try this:
var page = HttpContext.Current.CurrentHandler as Page; ScriptManager.RegisterStartupScript(page, page.GetType(), "alert", "alert('" + msg +"');window.location ='"+ aspx +"';", true);