CrazyPaste CrazyPaste - 3 months ago 27
HTML Question

JavaScript error: Uncaught TypeError: a[b] is not a function

In my C# Webforms project I have a

RadDatePicker
control set to run a
JavaScript
function. Each time I select a date, I get this Javascript error:


Uncaught TypeError: a[b] is not a function


function SetDateSession() {
console.log('here');
}

<telerik:RadDatePicker ID="StartDatePicker" runat="server">
<ClientEvents OnDateSelected="SetDateSession()" />
</telerik:RadDatePicker>


I can't figure out why this very simple code doesn't work. If I try to call the function with
onclick
from an
input
tag, it works.

<input type="button" id="RepBtn" onclick="SetDateSession()" value="View" runat="server"/>


Here is the console when I get the error:

enter image description here

I've simplified the code so much that it's hard for me to know what to try next.

Answer

What a waste of time on such a stupid thing! Basically this

<ClientEvents OnDateSelected="SetDateSession()" />

should be this

<ClientEvents OnDateSelected="SetDateSession" />

Lesson learned, Telerik! Thank you.

Comments