[CLOSED] Stop Change event of DateField on set value to DateField

  1. #1

    [CLOSED] Stop Change event of DateField on set value to DateField

    Hi,
    Ext Version: 2.5
    I am facing a problem like clearing ComboBox selected value on selection, when changing the combo box value setting the values to two datefield controls, these date fields are having Change event, in this Change event i am clearing the selection of combobox.

    <ext:ComboBox ID="cboDateRange" runat="server" Width="100" Editable="false">
                                        <Items>
                                            <ext:ListItem Text="Today" Value="lblToday" />
                                            <ext:ListItem Text="Tomorrow" Value="lblTomorrow" />
                                            <ext:ListItem Text="Last Week" Value="lblLastWeek" />
                                            <ext:ListItem Text="This Week" Value="lblThisWeek" />
                                            <ext:ListItem Text="Next Week" Value="lblNextWeek" />
                                            <ext:ListItem Text="Last Month" Value="lblLastMonth" />
                                            <ext:ListItem Text="This Month" Value="lblThisMonth" />
                                            <ext:ListItem Text="Next Month" Value="lblNextMonth" />
                                            <ext:ListItem Text="Last Year" Value="lblLastYear" />
                                            <ext:ListItem Text="This Year" Value="lblThisYear" />
                                            <ext:ListItem Text="Next Year" Value="lblNextYear" />
                                            <ext:ListItem Text="All" Value="lblAll" />
                                        </Items>
                                        <Listeners>
                                            <Select Handler="Ext.net.DirectMethods.SetDateRange(this.value);" />
                                        </Listeners>
                                    </ext:ComboBox>
    
    <ext:DateField runat="server" ID="dtFrom" Vtype="daterange">
                                        <Listeners>
                                            <Change Handler="cboDateRange.setValue('');" />
                                        </Listeners>
                                    </ext:DateField>
    <ext:DateField runat="server" ID="dtTo" Vtype="daterange">
                                        <Listeners>
                                            <Change Handler="cboDateRange.setValue('');" />
                                        </Listeners>
                                    </ext:DateField>
    
     <DirectMethod()> _
        Public Sub SetDateRange(ByVal id As String)
      dtFrom.SelectedDate = Now()
                    dtTo.SelectedDate = Now()
    End Sub
    After setting the values to DateField, the Change event is firing and setting the value of ComboBox to ''.

    Thank you.
  2. #2
    You can try SuspendEvents/ResumeEvents for DateField
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Quote Originally Posted by Vladimir View Post
    You can try SuspendEvents/ResumeEvents for DateField
    Thank you for response, i modified my code to like below and now it is working fine.

    dtFrom.SuspendEvents()
            dtTo.SuspendEvents()
     dtFrom.SelectedDate = Now()
                    dtTo.SelectedDate = Now()
    dtFrom.ResumeEvents()
            dtTo.ResumeEvents()
    Thank you

Similar Threads

  1. Replies: 6
    Last Post: Jan 09, 2013, 11:30 AM
  2. [CLOSED] Reject DateField-Change at failure
    By macap in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 16, 2010, 1:05 PM
  3. DateField AjaxEvent Change
    By Diabolicus in forum 1.x Help
    Replies: 3
    Last Post: Mar 03, 2009, 1:15 AM
  4. [CLOSED] Datefield - change language
    By Sharon in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 25, 2009, 7:59 AM
  5. How to cancel DateField change event
    By zikr in forum 1.x Help
    Replies: 4
    Last Post: Jan 16, 2009, 2:31 PM

Tags for this Thread

Posting Permissions