Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Error with client script + EditCommands

Reply
Thread Tools

Error with client script + EditCommands

 
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      07-07-2005
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!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWljaGFlbCBCYWx0aWM=?=
Guest
Posts: n/a
 
      07-07-2005
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!

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      07-07-2005
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.
 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      07-07-2005
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.
 
Reply With Quote
 
=?Utf-8?B?TWljaGFlbCBCYWx0aWM=?=
Guest
Posts: n/a
 
      07-07-2005
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.

 
Reply With Quote
 
=?Utf-8?B?Q2hhZA==?=
Guest
Posts: n/a
 
      07-07-2005
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!


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute a script from another script and other script does notdo busy wait. Rajat Python 3 01-08-2010 02:05 PM
RE: How to execute a script from another script and other script doesnotdo busy wait. VYAS ASHISH M-NTB837 Python 2 01-07-2010 08:18 PM
Odd script error when using client script callbacks (ASP.NET 2.0) =?Utf-8?B?TG93bGFuZGVy?= ASP .Net 0 03-27-2007 10:30 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
Server-side script with input parameter from Client-side script Magnus Blomberg ASP .Net 3 04-14-2005 12:21 PM



Advertisments