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>

"What can I say except Oustanding! Not only was your response clear, concise and complete, it was amazingly quick. I am very impressed and will certainly recommend in future. Thank you :-) "

Pete Davies

Random testimonial   All testimonials