Dont use System.Windows.Forms.MessageBox() method... it will create this kind of bugs......
instead use RegisterStartupScript() static method of ScriptManager class to run javascript on serverside to display simple alert message.
string msg = "<script>alert('your custom message');</script>";
ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), msg, false);