Error "Handler must be a function"


I have a problem with an AJAX calendar control on a gridview.

I add javascript to it on the row bound method for the OnClientDateSelectionChanged event.

Dim js As String = "dosomething('" & DaysX.ClientID & "','" & DaysY.ClientID & "')"
calendarEx.OnClientDateSelectionChanged = js
In javascript I have a function declared as


If the function is simply dosomething() no parameters the OnClientDateSelectionChanged  works

However I need to add parameters. When I add parameters the javascript is called followed by an error "Handler must be a function error"

Thanks in advance for assistance.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

DiveblueConnect With a Mentor Commented:
Sounds like you'll need to do some work in the onitemCreated event of the you can change attributes of the INSTANCE of the clendar that is on the row....
Luis PérezConnect With a Mentor Software Architect in .NetCommented:
Try this:

calendarEx.OnClientDateSelectionChanged = function() {

I think it will work for you.
in your code behind.......
Dim js As String = "dosomethingWithParams()"
calendarEx.OnClientDateSelectionChanged = js

In your script on the aspx......
function dosomethingWithParams()"
{dosomething('<%= DaysX.ClientID%>','<%=DaysY.ClientID%>');
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

remove the quote at the end of the js function definition, it's a typo
rwallacejAuthor Commented:
thanks for inputs;

hi diveblue
I made a slight mod so its like this
"javascript:function(){" & "dosomething(" & DaysX.ClientID & "," & DaysY.ClientID & ");};" to pickup the ID for each row. It does compile with no errors but javascript doesn't run - no alert message or anything.

hi DiveblueD
I like this idea however it doesn't work in my case. There are multiple DaysX client IDs etc as it is on  a gridview with each row having different IDs ( can't compile the page like this) so it didnt' work

rwallacejAuthor Commented:
thanks for help.....this got me on road to solution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.