473,569 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1109
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...@gma il.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
2112
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 = tmpHTML Before the changes, client-side .Net field validators (RegularExpressionValidator, RangeValidator, etc.) work fine... after the changes,...
26
15188
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 "locate.replace". I can do all this if the html page containing the script originates on the client machine, but don't know how to get access to a...
2
5468
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 information. (i.e. open an alert window when a record was not found in the database.) As I know opening such windows can be done on the client side...
1
2305
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 however my problem is that this code runs and brings up a Microsoft Internet Explorer Window telling the user they are going to be charged for the...
1
2306
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 my problem is that this code runs and brings up a Microsoft Internet Explorer Window telling the user they are going to be charged for the search...
1
2921
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 the unload event (client side not server side) of the <body> HTML element through javascript.
14
6277
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) show the error message next to the control. For example, if the text field is empty with RequiredField Validator control, it can show the value in...
4
4475
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 server event to fire to update the database. I've successfully done this with a normal webcontrol via: myControl.Attributes("onclick") =...
6
2484
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 has finished?
3
1590
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 contains a button, labeled "Process Now!" My goal is to examine the user's name and upload it into a database. Since all of the elements (the...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.