Rad DatePicker's Clear() is not working.- URGENT

3 posts, 0 answers
  1. Manish
    Manish avatar
    64 posts
    Member since:
    Jul 2011

    Posted 07 Feb 2012 Link to this post


    I am using rad datepicker and i am clearing it if today or future date is selected and i am using it as below

     function OnToDateSelected() {
                    var HidCurrentDate = document.getElementById("ctl00_MainContent_hidCurrentDate");
                    var CurrentDate = DateConversionForHidden(HidCurrentDate.value);

                    var ServerIdRadioBtnlst = "rblOwnerTypeC";
                    var tagNameRblbtnList = "input";
                    var rblListC = GetGridServerElement(ServerIdRadioBtnlst, tagNameRblbtnList);//this will find the id of control used in grid in js

                    var ServerIdRadioBtnlst = "rblOwnerTypeP";
                    var tagNameRblbtnList = "input";
                    var rblListP = GetGridServerElement(ServerIdRadioBtnlst, tagNameRblbtnList);
                    if (rblListP.checked == true) {

                        var serverIDTo = "rdpPeriodTo";
                        var tagNameTo = "input";
                        var rdpPeriodTo = GetGridServerElement(serverIDTo, tagNameTo);
                        var ToDate = DateConversion(rdpPeriodTo.value);

                        if (ToDate >= CurrentDate) {
                            alert("you can't use current or future date in previous Owner");
                            return false;


    <telerik:RadDatePicker ID="rdpPeriodTo" runat="server" Width="105px" Style="float: left;
                                                margin: 10px 0px 0px 0px;" ClientEvents-OnDateSelected="OnToDateSelected">
                                                <DateInput ID="DateInput2" runat="server" Font-Names="Georgia" >
                                                <Calendar ID="Calendar2" runat="server" ShowRowHeaders="false">
                                                        <telerik:RadCalendarDay Repeatable="Today" Date="">
                                                            <ItemStyle CssClass="rcToday" />

    above functionality is showing javascirpt error "Error: rdpPeriodTo.clear is not a function". I think it is not working due to rad date picker used in Grid .... but i am getting the id of that rad date picker by using GetGridServerElement() method (provide by telerik). Please help me it is urgent.
  2. Tsvetoslav
    Tsvetoslav avatar
    1823 posts

    Posted 09 Feb 2012 Link to this post

    Hello Manish,

    You need to modify the signature of your client-side OnToDateSelected method. It needs to be:
    function OnDateSelected(sender, args)

    Now, sender will hold a reference to your RadDatePicker and you can just call its clear() method: sender.clear().

    Hope it helps.

    Regards, Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft R3 2016 release webinar banner
  4. Manish
    Manish avatar
    64 posts
    Member since:
    Jul 2011

    Posted 09 Feb 2012 Link to this post

    Thanx ..... Its work....You are the man..
Back to Top