Client side alert

  • Thread starter Thread starter axapta
  • Start date Start date
A

axapta

Hi Guys,
I'm using this code in my asp.net page. It runs from a button webcontrol.

Dim sbJScript As String

sbJScript = "<script language = ""javascript"">"
sbJScript = sbJScript & "window.alert('Please choose either
Allocations or Homelessness');"
sbJScript = sbJScript & "window.close();"
sbJScript = sbJScript & "</script>"
litScript.Text = sbJScript
the alert doesn't appear and I get the following error: object reference not
set to an instance of an object. This occurs on the following line:
litScript.Text = sbJScript

How can I get an alert to appear client-side.
TIA
 
I don't do a lot of ASP.Net stuff, but a couple of things strike me as being
odd in what you posted. The code you are showing would appear to be the
code-behind pages, so it runs server side. I don't know what you are trying
to send the script to, because the declaration of litScript is not shown. I
don't know how the script would get launched on the client.

Your error though seems to indicate that litScript is declared but not
initialized.
 
Hi Guys,
I'm using this code in my asp.net page.  It runs from a button webcontrol.

            Dim sbJScript As String

            sbJScript = "<script language = ""javascript"">"
            sbJScript = sbJScript & "window.alert('Please choose either
Allocations or Homelessness');"
            sbJScript = sbJScript & "window.close();"
            sbJScript = sbJScript & "</script>"
            litScript.Text = sbJScript
the alert doesn't appear and I get the following error: object reference not
set to an instance of an object.  This occurs on the following line:
litScript.Text = sbJScript

How can I get an alert to appear client-side.
TIA

When you debug, what object does the warning say is null?

Thanks,

Seth Rowe [MVP]
 
Back
Top