How to stay on CustomAppointmentEditDialog form when check out some data is wrong?

4 posts, 1 answers
  1. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 13 Jul 2014 Link to this post

    Hi telerik Member:

    We need check some data before leave CustomAppointmentEditDialog form. 
    How can i stay on CustomAppointmentEditDialog form after check out some data is wrong?
    And same question in delete button.



    CustomerID: QD1612651
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 15 Jul 2014 Link to this post

    Hi Cooper,

    Thank you for writing.

    You can override the ValidateInput method of the EditAppointmentDialog an validate your data in there. This method is called once the OK button is clicked and if it returns false, the dialog will not be closed. Here is a small sample:
    protected override bool ValidateInput()
    {
        bool result = base.ValidateInput();
     
        if (txtEmail.Text == string.Empty)
        {
            this.errorProvider.SetError(this.txtEmail, "Emails field cannot be empty");
            return false;
        }
        return result;
    }

    I hope that you find this information useful.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 16 Jul 2014 in reply to Cooper Link to this post

    Thanks, it solved my problem.  

    I have the same question with the delete button.

    How do i stay on CustomAppointmentEditDialog Form after canceled the delete confirm dialog?
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 18 Jul 2014 Link to this post

    Hi Cooper,

    There is a method for the DeleteButton as well. It is called OnDeleteButtonClicked. Here is what is does:
    protected virtual void OnDeleteButtonClicked()
    {
        this.DeleteEvent();
        this.DialogResult = DialogResult.Abort;
        this.Close();
    }

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top