Show (Display) JavaScript Alert Message box in middle of screen from code behind in ASP.Net

Last Reply 14 days ago By dharmendr

Posted 15 days ago
The pop-up is on top center of the page, please suggest for middle of the page.
protected void Page_Load(object sender, EventArgs e)
    string message = "Hello! Mudassar.";
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append("<script type = 'text/javascript'>");
    ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());


You are viewing reply posted by: dharmendr 15 days ago.
Posted 15 days ago

Hi prawinrajkuma...,

This is browser inbuilt functionality and it is different in each brower. You can't change it.

If you wan to display center of page use jquery or bootstrap modal popup to display the message.

Refer below articles.

Open (Show) Bootstrap Modal Popup Window from Server Side (Code Behind) in ASP.Net

Open ( Show ) jQuery UI Dialog Popup Window from Server Side ( Code Behind ) in ASP.Net