Call JavaScript from Asp.Net code behind
Suppose you want to display confirmation message by javascript from asp.net code behind after saving data. Write the following code in your button event.
protected void btnSaved_Click(object sender, EventArgs e)
{
string msg = "Data saved sucessfully";
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script type=text/javascript<alert('" + msg + "')</script>");
}