views:

43

answers:

3

So I want to call a javascript function when I click on a telerik control.

<telerik:RadDatePicker Width="110" ID="rdpFromDate" runat="server" AutoPostBack="false" OnSelectedDateChanged="JSFunction();">

Can anyone tell me where I'm going wrong?

A: 

OnSelectedDateChanged is a server side event, this fires after a postback has occured not on the client side. So this property is expecting a .Net function not a JavaScript function.

You should be able to use the ClientEvent Node to register client event listeners see http://www.telerik.com/help/aspnet-ajax/calendar_pickerdisplayingthepopup.html and http://www.telerik.com/help/aspnet/calendar/radcalendar-telerik.webcontrols.base.calendar.clientside.calendarclientevents_members.html

<script ....>
    function dateSelected(params){...}
</script>
<telerik:RadDatePicker ....>
    <DateInput>
        <ClientEvents OnDateSelected="dateSelected">
    </DateInput>
</telerik:RadDatePicker>
David Waters
A: 

Check this out from the Telerik Docs: http://www.telerik.com/help/aspnet-ajax/calendar_clientsideondateclick.html

Arni Gunnar
A: 

Telerik has their own client side API and events for all their controls.

http://telerik.com/help/aspnet-ajax/calendar_clientsideevents.html

Ed B