My function to get an alert box on the page isn't working.
Instead it puts in the bottom section of the page:
<script type="text/javascript">
<!--
This is a test// -->
</script>
The function is:
public static void MessageAlert_Create(ref System.Web.UI.Page
thePage,
Type thisType,
string strMessage,
string strKey)
{
System.Web.UI.ClientScriptManager ClientScript =
thePage.ClientScript;
string strScript = "alert('" + strMessage + "');";
if (!ClientScript.IsStartupScriptRegistered(thisType,
strKey))
{
ClientScript.RegisterStartupScript(thisType, strKey,
strMessage, true);
}
}
and I call this function as follows:
System.Web.UI.Page pg = this;
Bus.UtilStatic.MessageAlert_Create(ref pg,
this.GetType(), "This is a test", "Tester");
any ideas how to get the alert box to show up?
George Ter-Saakov - 20 Jul 2007 15:30 GMT
Well change
ClientScript.RegisterStartupScript(thisType, strKey, strMessage, true);
to
ClientScript.RegisterStartupScript(thisType, strKey, strScript , true);
notice the difference.
strScript instead of strMessage in your code.
George.
> My function to get an alert box on the page isn't working.
> Instead it puts in the bottom section of the page:
[quoted text clipped - 27 lines]
>
> any ideas how to get the alert box to show up?