Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

Validations for controls on a panel not firing???


I am having problems with controls on a panel not firing.  The controls that
are directly on the form will validate, but the controls on the panel will
not validate.

I have the AutoValidate property for the form set to EnableAllowFocusChange
and then I call the ValidateChildren method when the save button is clicked.
If I cannot get the form to validate the controls, can I loop through each
control and call the validate event?

Thanks

private void toolStripReviewActionItemsSaveItem_Click(object sender,
EventArgs e)

{

    // Validate all of the children controls

    // If any controls fail validation then show message box and return

    if (!this.ValidateChildren(ValidationConstraints.Enabled))

    {

        // At least one of the controls failed validation

        MessageBox.Show(

            "Please correct the data and attempt the save again.",

            this.Text + " - Invalid Data",

            MessageBoxButtons.OK,

            MessageBoxIcon.Error,

            MessageBoxDefaultButton.Button1);

        // Return from the form and correct the bad data

        return;

    }

    // Validation was successful so save the dataset to the database

    doActionItemsSaveRecord();

    // Disable the controls that are used to add or edit records

    disableActionItemsAddEdit();

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc