Tuesday, February 10, 2009

Validation with hidden TabPanels in the ASP.NET Ajax Control Toolkit TabContainer

This one is a bit of a never ending story, unfortunately. After having found out how to hide tabs, I added validation logic to my TabContainer, only to find another bug:

When hiding a TabPanel by setting the Enabled property to false, any validation controls on that panel are still enabled. This is not what I expected, as with other types of panels, the Enabled property usually cascades down. Of course this results in validation errors displayed for hidden tabs.

I am now using the following (clumsy) work around to disable tabs:


    public static void DisableTab(TabPanel panel)


        panel.Enabled = false;


        //work around TabPanel bug and disable the validation controls




    private static void DisableValidationControls(Control c)


        foreach (Control child in c.Controls)


            if (child is BaseValidator)

                ((BaseValidator)child).Enabled = false;





Lets hope that the quality of the control toolkit gets improved soon.


Anonymous said...

Sorry to say this does not work in Safari browser!
Anyways thanks !!!

Anonymous said...

Had a similar issue with the ModalPopup. Setting up Validation Groups worked there. It may be worth a try