How to popup a message box in SharePoint 2010
22,571
From the comments it sounds like a simple change from MsgBox to alert will work for you. So you would just need the code to slightly modified to:
string script = "<script language='javascript'>alert('" + errorMessage + "')</script>";
Page.ClientScript.RegisterClientScriptBlock(GetType(), "Register", script);
Author by
Hinek
Developer started programming with QBasic / Turbo Pascal around 1992 about 14 years .NET experience about 11 years SharePoint experience likes TV series, as Firefly, Veronica Mars, Doctor Who, ... plays guitar and cajon
Updated on July 09, 2022Comments
-
Hinek almost 2 years
I built a control with a RenderingTemplate for a custom ContentType. It contains additional buttons. If the code behind one button fails, I want to inform the user with a message box.
I tried
string script = "<script language='javascript'>MsgBox('" + errorMessage + "')</script>"; Page.ClientScript.RegisterClientScriptBlock(GetType(), "Register", script);
But it doesn't show and I can't find the javascript code in the rendered page. What am I doing wrong? Is there a special SharePoint message box class in SharePoint 2010?