Using Validators in a TabStrip

5 posts, 2 answers
  1. Darlene
    Darlene avatar
    4 posts
    Member since:
    May 2008

    Posted 12 May 2008 Link to this post

    Hi!

    I have a TabStrip on my page and within one of the PageViews, there are controls that use validators such as RequiredFieldValidator.  When the validator is present, the tabs on the TabStrip do not work.  If I remove the validator, the TabStrip works as it should.  How can I make the TabStrip work with the validator?

    I have attached a small code sample that reduplicates the problem.

    Thank you!

    <form id="form1" runat="server">  
        <div> 
        <telerik:RadScriptManager ID="RSM" runat="server"></telerik:RadScriptManager> 
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Hay" MultiPageID="RadMultiPage1">  
                <Tabs> 
                    <telerik:RadTab Text="Tab 1" PageViewID="pv1" Selected="true"></telerik:RadTab> 
                    <telerik:RadTab Text="Tab 2" PageViewID="pv2"></telerik:RadTab> 
                    <telerik:RadTab Text="Tab 3" PageViewID="pv3"></telerik:RadTab> 
                </Tabs> 
            </telerik:RadTabStrip> 
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">  
                <telerik:RadPageView ID="pv1" runat="server">  
                    <asp:Label ID="Label1" runat="server" Text="This is tab 1"></asp:Label> 
                </telerik:RadPageView> 
                <telerik:RadPageView ID="pv2" runat="server">  
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="TextBox1"></asp:RequiredFieldValidator> 
                </telerik:RadPageView> 
                <telerik:RadPageView ID="pv3" runat="server">  
                    <asp:Label ID="Label3" runat="server" Text="This is tab 3"></asp:Label> 
                </telerik:RadPageView> 
            </telerik:RadMultiPage> 
        </div> 
        </form> 
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 May 2008 Link to this post

    Hi Darlene,

    Go through the following online demo.
    Validation Groups

    Princy.
  3. Answer
    Paul
    Admin
    Paul avatar
    4281 posts

    Posted 13 May 2008 Link to this post

    Hi Darlene,

    In order to achieve your goal you will have to set CausesValidation="False" in the definition of the tabstrip control.

    Another possible solution for this issue is to set the tabstrip AutoPostBack property to true and the multipage RenderSelectedPageOnly to true. This will prevent the invisible validators from firing.

    Regards,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Darlene
    Darlene avatar
    4 posts
    Member since:
    May 2008

    Posted 13 May 2008 Link to this post

    Thank you both!  It's working now :)
  5. Rory
    Rory avatar
    159 posts
    Member since:
    Jul 2007

    Posted 15 Mar 2010 Link to this post

    Hi Darlene,
    What if we want our "invisible validators" to fire?

    We are using tabstrip as a multi tab form and we are leveraging RenderSelectedPageOnly="True" to increase performance on page load and save times. The issue is if any field has a requiredfieldvalidator on another tab and you click save without visiting that tab the validation doesn't fire. We thought that at least the server side validation would fire since we can see the controls server side on save. Any help would be appreciated.
    Thanks.
Back to Top