Question

I have an Asp.net application in which i'd like to add a calendar extendar. So i use this code:

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Home.aspx.vb" Inherits="Home" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <cc1:ToolkitScriptManager   ID="ScriptManager1" runat="server" EnableScriptGlobalization="true"></cc1:ToolkitScriptManager>

        <span  style=" margin-left: 60%">
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="error1" Text="error1" ControlToValidate="FirstDate" ForeColor="Red" Font-Bold="true"></asp:RequiredFieldValidator>
       <asp:RegularExpressionValidator ID="RegularExpressionValidator1"  runat="server" ErrorMessage="error2" Text="error2" ControlToValidate="FirstDate"  ValidationExpression="^[0-3]+[0-9]\/[0-1]+[0-9]\/[0-9]{4}" ForeColor="Red" Font-Bold="true"></asp:RegularExpressionValidator>
        <asp:TextBox ID="FirstDate" runat="server"   ></asp:TextBox> 
            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="FirstDate" CssClass="test">
            </cc1:CalendarExtender>
        </span>
</asp:Content>

The problem is : when i click into the TextBox the calendar isn't shown :

  • Why this happens?
  • How can i modify my code to fix this error?
Was it helpful?

Solution

I don't believe that the CalendarExtender behaves the way you're expecting. At least, it doesn't for me. What I usually do is add an ImageButton and make the CalendarExtender's PopupButtonID equal to the ImageButton's ID.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top