473,387 Members | 3,781 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,387 software developers and data experts.

Error with client script + EditCommands

Hi,

I have the following server code that attaches a client side script to the
Update command of the data grid.
Private Sub clientExc_ItemCreated(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Handles clientExc.ItemCreated

If e.Item.ItemType = ListItemType.EditItem Then
CType(e.Item.Cells(4).Controls(0),
LinkButton).Attributes.Add("onclick", "buttonClick(this);")
End If
End Sub
The javascript is in an external js file.

What happens is when the page is loading in Edit mode after clicking the
edit button, but before clicking the update button, I see the following
script error:
'undefined' is null or not an object.

I have no idea what it is complaining about. If you have any ideas or
suggestions please feel free to post them.

Thank You!
Nov 19 '05 #1
5 1145
This usually means that the function is not correctly specified, misspelled
or missing.

Make sure that you are correctly referencing the JavaScript file on your
page. You can debug JavaScript by looking at the running documents when you
are in debug mode.

Also, view source when your page loads in the browser. Make sure that the
script was attached and the reference is included in the page.
--
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group

Future Business Model
Loan Origination Services
National City Mortgage
"Chad" wrote:
Hi,

I have the following server code that attaches a client side script to the
Update command of the data grid.
Private Sub clientExc_ItemCreated(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Handles clientExc.ItemCreated

If e.Item.ItemType = ListItemType.EditItem Then
CType(e.Item.Cells(4).Controls(0),
LinkButton).Attributes.Add("onclick", "buttonClick(this);")
End If
End Sub
The javascript is in an external js file.

What happens is when the page is loading in Edit mode after clicking the
edit button, but before clicking the update button, I see the following
script error:
'undefined' is null or not an object.

I have no idea what it is complaining about. If you have any ideas or
suggestions please feel free to post them.

Thank You!

Nov 19 '05 #2
It appears to be executing the javascript code because an alert box i
showing, I can't seem to figure out how to debug the script.
Nov 19 '05 #3
OK I got it to debug finally, the error is in a MS Script
function ValidatorOnLoad
Very strang since I commented out these controls, now I removed them and no
error.
Nov 19 '05 #4
You commented out the controls on your aspx page or the code behind? If you
commented them out of the aspx page, then they might still be in the code
behind page. They would get added to the form on load, then the client side
script wouldn't see the validator object. Boom! Error! When you comment
out a control on the aspx page, make sure they are removed from the code
behind.

The IDE will usually re-declare the object if you comment it out in the code
behind and not the aspx page.
--
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group

Future Business Model
Loan Origination Services
National City Mortgage
"Chad" wrote:
OK I got it to debug finally, the error is in a MS Script
function ValidatorOnLoad
Very strang since I commented out these controls, now I removed them and no
error.

Nov 19 '05 #5
I commented out the controls in the aspx page and verfied that there was no
more declarations for them in the codebehind. The page must have been cached
or something, not sure.
Thank you for your help!
Nov 19 '05 #6

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

Similar topics

5
by: Philip Ronan | last post by:
OK, here's my 2p worth: === Q. Why am I getting the error message 'Headers already sent'? A. PHP produces this error message when you try to set a header for a web page after you have already...
1
by: questionr | last post by:
There is a spell checker function which is written in VB Script. The function works well when tested seperately. But when the function is called from Java Script, the function shows an Error saying...
0
by: Roman | last post by:
I'm trying to create the form which would allow data entry to the Client table, as well as modification and deletion of existing data rows. For some reason the DataGrid part of functionality stops...
25
by: moondaddy | last post by:
I have an application where users need to upload images and in my web.config file I have a setting like this: <httpRuntime maxRequestLength="512" /> Which restricts image larger than 500k from...
7
by: dd | last post by:
Hello all. First, I'm a newbie to javascript but not to ASP. Secondly I've been searching for the answer for two hours and I decided to finally post this question. I'm trying to take a...
5
by: Bjorn Sagbakken | last post by:
Hello I have just migrated from VS 2003 to VS 2005, and .NET framework 1.1 to 2.0 I am at the end of debugging and fixing stuff. Now there is one error I just cannot find a solution to: On...
2
by: pranas | last post by:
I'm not a proffessional programmer and I'm asking for your help. I'm using PHP and running Apache server and Mysql database server on my home network computer to serve my web site. My PHP error log...
7
by: adrian.bartholomew | last post by:
Im getting an error: Error: unterminated string literal Source File: http://98.214.38.110/allfours/site_flash/2.php Line: 75, Column: 37 Source Code: if (_ie == true) document.writeln(' ...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.