[CLOSED] Is there a way to tell if the "Today" button or a date item was clicked on a datepicker ?

  1. #1

    [CLOSED] Is there a way to tell if the "Today" button or a date item was clicked on a datepicker ?



    I would like to run a function selectToday() when the "Today" button is clicked. Right now the selectCalendarDate function is always called no matter what is clicked on in the calendar.

    <ext:DatePicker ID="DatePicker1"
      runat="server" 
      EnableViewState="true" 
      MinDate="01/01/1990" 
      MaxDate="12/31/2020" 
      ShowToday="true"
      TodayText="this day">
      <Listeners> 
        <Select Fn="selectCalendarDate" />
      </Listeners>
    </ext:DatePicker>
  2. #2

    RE: [CLOSED] Is there a way to tell if the "Today" button or a date item was clicked on a datepicker ?

    Hi,

    There is no public way to set your own handler. But you can override default handler
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    *** "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    *** protected void Button1Click(object sender, AjaxEventArgs e)
    *** {
    ******* 
    *** }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
    *** <title></title>* 
    *** 
    *** <script type="text/javascript">
    ******* function todayHandler() {
    *********** //default handler
    *********** if (this.todayBtn &amp;&amp; !this.todayBtn.disabled) {
    *************** this.setValue(new Date().clearTime());
    *************** this.fireEvent("select", this, this.value);
    *********** }
    *********** //own required code
    *********** alert("Clicked today button of " + this.id);
    ******* }
    *** 
    ******* 
    *** </script>
    </head>
    <body>
    *** <form id="form1" runat="server">
    ******* <ext:ScriptManager ID="ScriptManager1" runat="server">
    ******* </ext:ScriptManager>
    ******* 
    ******* <ext:DatePicker ID="DatePicker1"
    ********* runat="server" 
    ********* EnableViewState="true" 
    ********* MinDate="01/01/1990" 
    ********* MaxDate="12/31/2020" 
    ********* ShowToday="true"
    ********* TodayText="this day">
    *********** <CustomConfig>
    *************** <ext:ConfigItem Name="selectToday" Value="todayHandler" Mode="Raw" />
    *********** </CustomConfig>
    ******* </ext:DatePicker> 
    ******* 
    ******* 
    *** </form>
    </body>
    </html>
  3. #3

    RE: [CLOSED] Is there a way to tell if the "Today" button or a date item was clicked on a datepicker ?

    Hi,
    Thanks for your advise. But can we also override the default handler for the NextMonth or PreviousMonth buttons? I am looking for this for a long time.

Similar Threads

  1. [CLOSED] CalendarPanel : Today date
    By ddslogistics in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 01, 2011, 3:47 PM
  2. DatePicker: get Min Date and Max Date just displayed
    By Journeyman79 in forum 1.x Help
    Replies: 0
    Last Post: Mar 16, 2011, 10:41 AM
  3. Replies: 3
    Last Post: Feb 02, 2010, 6:32 PM
  4. [CLOSED] Validator for date, grater than today
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 03, 2009, 10:41 AM
  5. [CLOSED] DatePicker selected date
    By methode in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 29, 2008, 12:05 PM

Posting Permissions