dotnetN00b
dotnetN00b

Reputation: 5131

How to make ASP.NET AJAX CalendarExtender always visible?

I'd like to be able to have the .NET AJAX CalendarExtender show on Load without having to click in a TextBox. If I can simulate a TextBox being clicked so the CalendarExtender will show I'll take that too.

Upvotes: 1

Views: 3178

Answers (2)

BornToCode
BornToCode

Reputation: 10213

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />


  <asp:TextBox runat="server" ID="txtboxFilter" ClientIDMode="Static" />
  <ajaxToolkit:CalendarExtender runat="server" TargetControlID="txtboxFilter" />


    <script type="text/javascript">
      document.getElementById('txtboxFilter').focus();
    </script>

Upvotes: 0

David
David

Reputation: 73564

The CalendarExtender does not support it. You could write your own, but it would be much simpler to just use a standard Calendar control if you want a calendar that's always visible.

The extender was meant for use with a textbox when you want the calendar to pop up as needed. Why write a new control when the basic control already exists?

Edit

To address the point in the comment about needing to switch years easily. I COMPELTELY understand. This is a frustration for me as well. however, there are several ways to overcome this. One good example can be found here: https://web.archive.org/web/20210304123649/https://www.4guysfromrolla.com/articles/090104-1.aspx

Upvotes: 2

Related Questions