Hi,
I have a form that allows the user to change from and to date.
But if the user changes the "to date" to an illegal date (defined by the database) the user will get an message where he can override this error or not. If hi does not override it, i want the date to be reset (cancel the valuechanging) event.
But the value in the datetimepicker stays at the date selected by the user regardless of me doing cancel = true or not.
How can i achieve this functionality without triggering the change event once again?
Regards
Svein Thomas
I have a form that allows the user to change from and to date.
But if the user changes the "to date" to an illegal date (defined by the database) the user will get an message where he can override this error or not. If hi does not override it, i want the date to be reset (cancel the valuechanging) event.
But the value in the datetimepicker stays at the date selected by the user regardless of me doing cancel = true or not.
How can i achieve this functionality without triggering the change event once again?
Regards
Svein Thomas
5 Answers, 1 is accepted
0
Hello Svein,
Thank you for contacting Telerik support.
I was able to reproduce the described behavior.You can work around this by subscribing to the nested TextBoxElement ValueChangind event:
This is an issue of RadDateTimePicker and I have logged it to our Public Issue Tracker under ID 10696 . To vote for it and subscribe for its status updates, follow this link: http://www.telerik.com/support/pits.aspx#/public/winforms/10696.
Please excuse us for the caused inconvenience.
Your Telerik points have been updated.
All the best,
Peter
the Telerik team
Thank you for contacting Telerik support.
I was able to reproduce the described behavior.You can work around this by subscribing to the nested TextBoxElement ValueChangind event:
private
void
Form1_Load(
object
sender, EventArgs e)
{
this
.radDateTimePicker1.DateTimePickerElement.TextBoxElement.ValueChanging +=
new
CancelEventHandler(TextBoxElement_ValueChanging);
}
void
TextBoxElement_ValueChanging(
object
sender, CancelEventArgs e)
{
Telerik.WinControls.UI.ValueChangingEventArgs args = e
as
Telerik.WinControls.UI.ValueChangingEventArgs;
args.Cancel =
true
;
}
This is an issue of RadDateTimePicker and I have logged it to our Public Issue Tracker under ID 10696 . To vote for it and subscribe for its status updates, follow this link: http://www.telerik.com/support/pits.aspx#/public/winforms/10696.
Please excuse us for the caused inconvenience.
Your Telerik points have been updated.
All the best,
Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Allen
Top achievements
Rank 1
answered on 03 Sep 2013, 03:56 AM
same problem here. i need to check the new value before i cancel the new value.
by using
by using
this
.radDateTimePicker1.DateTimePickerElement.TextBoxElement.ValueChanging
, how can i check the new value entered?0
Hello Allen,
Thank you for contacting Telerik Support.
You should cast the CancelEventArgs to ValueChangingEventArgs in order to get the new value from the ValueChangingEventArgs.NewValue property:
I hope this helps.
Regards,
Peter
Telerik
Thank you for contacting Telerik Support.
You should cast the CancelEventArgs to ValueChangingEventArgs in order to get the new value from the ValueChangingEventArgs.NewValue property:
private
void
Form1_Load(
object
sender, EventArgs e)
{
this
.radDateTimePicker1.DateTimePickerElement.TextBoxElement.ValueChanging +=
new
CancelEventHandler(TextBoxElement_ValueChanging);
}
void
TextBoxElement_ValueChanging(
object
sender, CancelEventArgs e)
{
Telerik.WinControls.UI.ValueChangingEventArgs args = e
as
Telerik.WinControls.UI.ValueChangingEventArgs;
if
( args.NewValue ==
null
)
args.Cancel =
true
;
}
I hope this helps.
Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Allen
Top achievements
Rank 1
answered on 04 Sep 2013, 06:07 AM
that worked.
but would be better if the valuechanging event can be cancelled instead of hooking to the textboxelement. :)
but would be better if the valuechanging event can be cancelled instead of hooking to the textboxelement. :)
0
Hi Allen,
This is an issue of RadDateTimePicker and this is logged in our Public Issue Tracker under ID 10696. You can workaround this issue by handling the hosted MaskedText's ValueChanging event. This event requires casting from CancelEventArgs to ValueChangingEventArgs.
Please, excuse us for the inconvenience. Do not hesitate to contact us if you have other questions.
Regards,
Peter
Telerik
This is an issue of RadDateTimePicker and this is logged in our Public Issue Tracker under ID 10696. You can workaround this issue by handling the hosted MaskedText's ValueChanging event. This event requires casting from CancelEventArgs to ValueChangingEventArgs.
Please, excuse us for the inconvenience. Do not hesitate to contact us if you have other questions.
Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>