In addition to incorrectly using "alert" as your function name, you say
"What I wanted to do was to pop up an alert message".
So I understand that when the page loads on the client side you want the
message to pop up? Then something must call the function as well. If so,
then changing your "stralertscript =" to the following will give the pop up,
and use RegisterClientScriptBlock
stralertscript = "<script language='javascript'> "+
" alert ('Testpaper not found'); "+
"</script> ";
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Please check the string in "stralertscript ".
if ( ds.Tables["studentTestpaper"].Rows.Count == 0 )
{
stralertscript = "<script language='javascript'> "+
" function alert() "+
" { "+
" alert ('Testpaper not found'); "+
" return true; "+
" } </script> ";
Page.RegisterStartupScript ("stralertscript", stralertscript);
}
What I wanted to do was to pop up an alert message. The IF function works
fine, but the alert doesn't appear. Should I use RegisterStartupScript or
RegisterClientScriptBlock ?
TIA
Andrew.