ASP.NET Calendar - Knowledge Base

« Back to Knowledge Base list

How to set focus to the textbox after date is selected?

Q:

How to set focus to the textbox after date is selected?

A:

Use the OnClientDateChanged event.


ASPX

<asp:textbox runat="server" id="txtDate" />
<obout:Calendar runat="server" 
        DatePickerMode = "true" 
        TextBoxId = "txtDate"
        DatePickerImagePath = "styles/icon2.gif" 
        OnClientDateChanged="onDateChange" />



JavaScript

<script type="text/javascript">
        function onDateChange(sender, selectedDate)
        {
                sender.Ob.focus();
        }
 </
script>

"Thanks for the awesome support and incredible product!"

Andy Mason

Random testimonial   All testimonials