Question

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?

Was it helpful?

Solution

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>

OTHER TIPS

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top