So I w开发者_JAVA技巧ant 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?
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>
Check this out from the Telerik Docs: http://www.telerik.com/help/aspnet-ajax/calendar_clientsideondateclick.html
Telerik has their own client side API and events for all their controls.
http://telerik.com/help/aspnet-ajax/calendar_clientsideevents.html
精彩评论