Error with client script + EditCommands

G

Guest

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!
 
G

Guest

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
 
G

Guest

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.
 
G

Guest

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.
 
G

Guest

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
 
G

Guest

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top