473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Client side alert

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

Jun 27 '08 #1
2 1101
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.

"axapta" wrote:
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
Jun 27 '08 #2
On Jun 2, 3:00*pm, "axapta" <jas.jac...@gmail.comwrote:
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]
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MonkeyBoy | last post by:
I am doing some some HTML manipulation in client-side script (IE5.x and IE6.x browsers only). Something like.. var tmpHTML = oTable.outerHTML // do something to the HTML her oTable.outerHTML =...
26
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via...
2
by: Manu | last post by:
In my ASPX code I would like to open a new window, send a message box, create an alert window etc. The logic when to do the above is implemented in the server side, as it is depended upon Database...
1
by: Stephen | last post by:
Hey Everyone, I have a problem with a web application due to the use of both client-side and server side script on the on-click event of a button. The client side script runs first as expected...
1
by: Stephen | last post by:
Hey All, I have a problem with a web application due to the use of both client-side and server side script on the on-click event of a button. The client side script runs first as expected however...
1
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
4
by: Barb | last post by:
I have a user control as my Save button for my page. When the Save button is clicked, I want some client-side validation to take place from a javascript function in the page, and then I'd like the...
6
by: adolf garlic | last post by:
A postback I'm doing takes ages to get the data which it then uses to populate a table. What I want to know is: How can I get the client side to fire a 'resize' event when the postback thing...
3
by: Larry David | last post by:
Hi, I'm just trying to wrap my mind around the ASP.NET model. Let me walk you through a trivial scenario: Let's say I have a form containing a text box where the user enters his name. It also...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.