Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / WebDatePicker ValueChanged Event question

WebDatePicker ValueChanged Event question

New Discussion
Chris Walker
Chris Walker asked on Jul 4, 2017 5:08 PM

I have a datepicker linked to a calendar control as follows:

 

 

 

 

 

<

 

 

 

ig:WebDatePicker ID=”StartDate” DropDownCalendarID=”StartDate_WebMonthCalendar” runat=”server” OnEnterKeyPress=”NewFilter” OnValueChanged=”NewFilter” AutoPostBackFlags-ValueChanged=”On” AutoPostBackFlags-EnterKeyDown=”On” > </ig:WebDatePicker>

 

 

 

<ig:WebMonthCalendar ID=”StartDate_WebMonthCalendar”  runat=”server”> </ig:WebMonthCalendar>

My question is that when the dropdown Calendar appears and I select a new date, the new date appears in the WebDatePicker textbox. I would  then expect a valuechanged event to fire but it doesn’t. What I had to do is move the OnValueChange and AutoPostbackFlags-ValueChanged to the WebMonthCalendar control and in the Server-side event handler sync the two control’s date/selecteddate.

Is this the way its supposed to work or am I missing something?

 

 

Sign In to post a reply

Replies

  • 0
    [Infragistics] Tsvetelina Georgieva
    [Infragistics] Tsvetelina Georgieva answered on Jul 19, 2010 3:24 PM

    Hello Chris,

     

    If you want to handle every change of the WebMonthCalendar's value you  should use

    OnSelectedDateChanged

    <ig:WebMonthCalendar ID="WebMonthCalendar1" runat="server" Height="200px"

    OnSelectedDateChanged ="WebMonthCalendar1_SelectedDateChanged"

    Width ="225px">

    <AutoPostBackFlags SelectionChanged="On" />

    </ig:WebMonthCalendar >

     

    protected void WebMonthCalendar1_SelectedDateChanged(object sender, Infragistics.Web.UI.EditorControls.CalendarSelectedDateChangedEventArgs e)

    {

    WebDatePicker1.Date = e.NewDate;

    }

     

    Otherwise you have to click otside of the WebDatePicker in order to fire the OnValueChanged event

    <ig:WebDatePicker ID="WebDatePicker1" runat="server"

    DropDownCalendarID="WebMonthCalendar1"

    onvaluechanged ="WebDatePicker1_ValueChanged">

    <AutoPostBackFlags ValueChanged="On" />

    </ig:WebDatePicker >

     Let me know if you need more assistance regarding this.

    • 0
      Kurt
      Kurt answered on Apr 13, 2011 7:50 PM

      I have two WebDatePickers to select a date range which I initialize with pre-selected dates.  When the dates are changed I have it reloading a WebDataGrid.

      I'm using the WebMonthCalendar 's OnSelectedDateChanged  like described in the post above with the AutoPostBackFlag-ValueChanged set to "On"  to get the selection of a date in the calendar to automatically post back and change the contents of the grid.  However, I'm getting an annoying behavior.  When initially running the application, the first time I click on the arrow to display the month calendar drop down, a post-back occurs and the calendar does not display.  Any subsequent clicks on the arrow do not cause a postback and the control works just fine as I had expected.  I currently have the EditMode of the WebDatePicker set to "CalendarOnly".  If I do not set this and allow the user to change the date manually by typing in the edit box, the annoying behavior returns upon once again clicking on the arrow to display the calendar.

      Is there anything I can do to keep this unneeded initial postback event from firing? 

      Thanks.

      • 0
        Chris Walker
        Chris Walker answered on Apr 13, 2011 8:13 PM

        I recall having that issue as well. When you initially set the date in the Edit control (Webdatepicker) you also need to set the dropdown's selected date.

        DateTime myDate = DateTime.Now;

        myDatePicker.Date = myDate;

        myDatePicker_WebMonthCalendar.SelectedDate = myDatePicker.Date;

         

        See if that takes care of your initial postback.

      • 0
        Kurt
        Kurt answered on Apr 13, 2011 8:23 PM

        Thank you so much, Chris!  That solved the problem.  I don't think I would have thought but it makes logical sense.

      • 0
        Jesse Oresnik
        Jesse Oresnik answered on Jun 16, 2014 8:46 PM

          How would you change this to access the changed date for a webDatePicker that is in an item template of a webGridView? (Sorry for necro'ing an old post, but there's so little activity on these forums, I doubt it matters)

    • 0
      Bikash
      Bikash answered on Jul 4, 2017 5:08 PM

      This is my Client side code :

      <igsch:WebDateChooser ID="cntlDatePicker" runat="server" AllowNull="False" Width="85px" on>
      <AutoPostBack ValueChanged="True"></AutoPostBack>
      <CalendarLayout FooterFormat="Today: {0:d}" AllowNull="False" SelectedDate="2005-06-03" VisibleMonth="2005-06-03"></CalendarLayout>
      </igsch:WebDateChooser>

      And this is my event code,

      cntlDatePicker.Value = e.Value

      Dim myDate As String = cntlDatePicker.Value.ToString

      i wish to capture the get selected date, but newDate property is unavailable for me.
      Kindly Help

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Chris Walker
Favorites
0
Replies
6
Created On
Jul 04, 2017
Last Post
8 years, 9 months ago

Suggested Discussions

Created by

Created on

Jul 4, 2017 5:08 PM

Last activity on

Feb 24, 2026 9:05 AM