Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
810
WebDatePicker and Time
posted

Hi,

 

I have a webdatepicker in my web form. On pick of any date in the calendar the default time comes as 12:00 am. Is there a way when pick on date the current system time should be picked. I need the DateTime value from txtDate.Date parameter.

 

 

 

 

 

 

<ig:WebDatePicker ID="txtDate" runat="server" DisplayModeFormat="MM/dd/yyyy h :mm">

<Buttons SpinButtonsDisplay="OnRight"></Buttons></ig:WebDatePicker>

Thanks

Parents
  • 19693
    Suggested Answer
    posted

    Hello ssvan,

    You can handle ValueChanged event:

            <ig:WebDatePicker ID="txtDate" runat="server" DisplayModeFormat="MM/dd/yyyy h:mm"

                EditModeFormat="MM/dd/yyyy h:mm" onvaluechanged="txtDate_ValueChanged">

                <AutoPostBackFlags ValueChanged="On" />

                <Buttons SpinButtonsDisplay="OnRight">

                </Buttons>

            </ig:WebDatePicker>

     

      protected void txtDate_ValueChanged(object sender, Infragistics.Web.UI.EditorControls.TextEditorValueChangedEventArgs e)

        {    

            DateTime currentValue = DateTime.Now;

            DateTime newValue = (DateTime)e.NewValue;

            txtDate.Value = new DateTime(newValue.Year,newValue.Month, newValue.Day, currentValue.Hour, currentValue.Minute,currentValue.Second);      

        }

    Hope this helps.

Reply Children
No Data