In normal scenario when there is need to show pop-up message on any event in web pages then we generally go either with some java script code to our header or some third party control but here is some simple logic by which we can generate pop-up message in any event at any web page.
Firstly we need to check that whether we use any update panel in our page or not. If we do not use any update panel in our .aspx page then we can apply following code at any event to generate pop-up.
Response.Write("<script language=javascript>alert('Message here.')</script>");
But if we use any Update Panel inside our .aspx page then we must go with some different logic which is as follows:
ScriptManager.RegisterStartupScript(this.UP, typeof(string), "Alert", "alert('Message here');", true);
where this.UP represent current Update Panel Id, so you can replace 'UP' with your Update Panel Id.
Here we done with single line pop-up generate code, Hope this will help you guys....
Happy Coding.