Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
RequiredFieldValidator where ControlToValidate is inside a WebTab
posted

I've got an issue where i've got a number of controls inside an UltraWebTab control.

Players:

  • UltraWebTab within asp.net form & multiple tabs
  • RequiredFieldValidator controls outside the UltraWebTab

Scenario:

 Amidst the multiple tabs there are controls which need to be validated upon postback. I had initially put the respective validators within the tabs that the controls to validate were located, however without an easy way to alert the user that specific tabs had invalid data, I opted to put the validators outside the UltraWebTab, where the user would be able to see all of the problems without clicking through each tab.

However, when I move the validators outside the webtab, the page won't load because the ControlToValidate cannot be found on the page. Any ideas?

Parents
  • 220
    Verified Answer
    posted

    Workaround / Solution:

    Because the failure was happening OnPreRender, i took the design-time configuration out of the RequiredFieldValidator, and in the overrided OnPreRender() method (for the page), added the UniqueID of the control to the ControlToValidate property of the RFV...
     

      229 

      230         protected override void OnPreRender(EventArgs e)

      231         {

      232             this.reqBuild.ControlToValidate = this.txtBuild.UniqueID;

      233 

      234             base.OnPreRender(e);

      235         }
      236
Reply Children
No Data