This is a migrated thread and some comments may be shown as answers.

[Solved] Autopostback with datepicker

1 Answer 504 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 05 May 2009, 09:01 PM
Hi,
 I have added button to the footer of the datepicker. When i click on it it calls the "onclientclick" event which populate the today date on the dateinput space and close the datepicker. The issue is,after the after the datepicker is closed there is a automatic postback. I tried to do partialpostback with update panel which did not work too.Please let me know how I can solve the issue and not have automatic postback.

<FooterTemplate>
                             <asp:ImageButton ID="IBToday" runat="server" OnClientClick="SelectToday()" ImageUrl="~/Skins/Web20/Calendar/MonthYearTodayBtn.gif" />
 </FooterTemplate>

function SelectToday()
{
    var currentDate = new Date()
    var picker = $find("<%= datepicker1.ClientID %>");
    picker.set_selectedDate(currentDate);   
    picker.hidePopup();       

}

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 06 May 2009, 06:31 AM
Hi John,

Add return false; in OnClientClick of ImageButton in order to avoid the postback.

ASPX:
 
<telerik:RadDatePicker ID="datepicker1" runat="server">  
    <Calendar runat="server">  
    <FooterTemplate> 
        <asp:ImageButton ID="IBToday" runat="server" OnClientClick="SelectToday(); return false;" ImageUrl="~/Images/Today.gif" /> 
    </FooterTemplate>          
    </Calendar> 
</telerik:RadDatePicker> 

Thanks,
Princy.
Tags
Calendar
Asked by
John
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or