When we use AJAX into the page then we cannot show alert message using RegisterStartupScript to show the alert message in AJAX page you can use the below code
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alertmsg", "alert('Your Message!.');", true);