[RESOLVED] help with alert messagebox

Hi!

I'm new to JScript and have no idea why this code doesn't work.

protected void ClearAllOrders_OnClick( object sender, System.Web.UI.ImageClickEventArgs e )
{
string showmessage = "r du sker p att du vill rensa all betsllningsdata";
string alertScript = "<script language=JavaScript>";
alertScript += " alert( showmessage ); ";
alertScript += "< /script> ";
if( Page.IsClientScriptBlockRegistered("alert") )
{
Page.RegisterClientScriptBlock( "alert", alertScript );
}
}

When I debugg this code it says can't find method in objectinstance under Page.IsClientScriptBlockRegistered("alert")
[712 byte] By [Visslan] at [2007-11-20 6:12:57]
# 1 Re: [RESOLVED] help with alert messagebox
It looks like Page.IsClientScriptBlockRegistered("alert") is set up to be part of a prototype. That means that this is custom code. Can you post the whole source? Or is this a large project?

I would assume that someone else wrote this. Or did you make this yourself?
PeejAvery at 2007-11-8 0:42:00 >
# 2 Re: [RESOLVED] help with alert messagebox
Oh I found it this works =) :

string showmessage = "r du sker p att du vill rensa all betsllningsdata";
string alertScript = "<script language='JavaScript'>";
alertScript += " window.alert( '"+ showmessage +"' ); ";
alertScript += "</script> ";

if (!Page.IsStartupScriptRegistered("alert"))
{

Page.RegisterStartupScript("alert", alertScript);
}
Visslan at 2007-11-8 0:43:06 >
# 3 Re: [RESOLVED] help with alert messagebox
Glad to hear it. :wave:
PeejAvery at 2007-11-8 0:44:08 >