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?
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%>');
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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
All Courses

From novice to tech pro — start learning today.