Partial Page Post-Back and The Property Proxy Validator – CTD

As a quick follow-up to this post, I disabled the PropertyProxyValidator on the RowUpdating Event Handler of the other control and it worked fine

 

        protected void GridViewFamily_RowUpdating(object sender, GridViewUpdateEventArgs e)

        {

            PropertyProxyValidator propertyProxyValidator =

                GenericUtilities.FindAChildControl(this.DetailsViewInsertFamily, "PropertyProxyValidatorInsertPersonName") as PropertyProxyValidator;

            propertyProxyValidator.Enabled = false;

 

        }

 

FindaChildControl is a just a recursive method to find a control on a web page:

        public static Control FindAChildControl(Control control, string controlId)

        {

            Control targetControl = null;

            foreach (Control childControl in control.Controls)

            {

                if (childControl.ID == controlId)

                {

                    targetControl = childControl;

                }

                if (targetControl == null && childControl.Controls.Count > 0)

                {

                    targetControl = FindAChildControl(childControl, controlId);

                }

            }

            return targetControl;

        }

 

The fact that I have to do this is very annoying – it adds more code to the project, therefore increasing the cost to develop and maintain it.  I noticed that the out of the box ASP.NET validators do not have this problem – they only fire when the control that they are associated is updating/inserting…   I would argue that the Ent Lib validators need to add this feature.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: