Regarding Datetimepicker

Hi Consider there are Two Datetimepicker, which is Namely Opendate and Closedate. Steps are : In ''opendate'' Datetimepicker , there is the defualt Setting value(Eg : 01/02/2002 : 13:55:30(dd/mm/yyyy)). My question is I want to change (only)Year in the "Opendate" using keyborad(Arrow Keys), after edit the year, i want to press the "Closedate" or next i want to focus the Closedate field by pressing mouse key. Actual Result: I could not get the new edited year value Excepted Result: Year should change,, Note : After change the Year , directly move the cursor into next field "Closedate", Dont try by mouse selection These are the codes: private void dtpOpeningDate_Validating(object sender, CancelEventArgs e) { if (!mStockpile.CloseDate.IsNull && dtpOpeningDate.Value.Value >= mStockpile.CloseDate.Value) { dtpOpeningDate.Value = mStockpile.OpenDate; MessageBox.Show(mInvalidOpeningDateMsg, Application.ProductName, MessageBoxButtons.OK ,MessageBoxIcon.Information); e.Cancel = true; } } private void dtpOpeningDate_Validated(object sender, EventArgs e) { mStockpile.OpenDate = dtpOpeningDate.Value.Value; }

2 Replies

AR Anupama Roy Syncfusion Team March 29, 2006 02:16 PM UTC

Hi Sathish, I checked with the following code with the given conditions and this works for me. private void dtpOpeningDate_Validated(object sender, System.EventArgs e) { this.CloseDate.Value =this.dtpOpeningDate.Value ; } private void dtpOpeningDate_Validating(object sender, CancelEventArgs e) { if ( dtpOpeningDate.Value>= this.CloseDate.Value) { this.CloseDate.Value =this.dtpOpeningDate.Value ; e.Cancel = true; } } Have you used syncfusion DateTimePickerAdv control itself? I could see dtpOpeningDate.Value.Value in your coding which seems to be wrong. Please let me know if you need furthur assistance. Thanks, Anu.


SB Sathish Basakran March 29, 2006 09:27 PM UTC

Hey Thanks Anu, much appreciated. Sathish

Loader.
Up arrow icon