tab & requiredFieldValidator

2 posts, 1 answers
  1. Balan
    Balan avatar
    10 posts
    Member since:
    May 2008

    Posted 22 May 2008 Link to this post

     Hello !

    I have 2 tabs and 2 radPageView's, each other with a textBox,

    a requiredFieldValidator and a button. When I press first

    button, it take in consideration both validators and I don't

    agree that. Could you help me. please ?

    Have a nice day !

    <telerik:RadTabStrip ID="RadTabStrip1" runat="server"

    SelectedIndex="0" MultiPageID="RadMultiPage1"

    CausesValidation="false">
            <Tabs>
                <telerik:RadTab runat="server" Text="Root

    RadTab1" Selected="true" PageViewID="rpv1">
                </telerik:RadTab>
                <telerik:RadTab runat="server" Text="Root

    RadTab2" PageViewID="rpv2">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server"

    SelectedIndex="0" >
            <telerik:RadPageView ID="rpv1" runat="server">
                <asp:TextBox ID="TextBox1"

    runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator

    ID="RequiredFieldValidator1" runat="server"

    ErrorMessage="RequiredFieldValidator"

    ControlToValidate="TextBox1">*</asp:RequiredFieldValidator>
                <br /><asp:Button ID="Button1" runat="server"

    Text="Button1"
                    onclick="Button1_Click" />
            </telerik:RadPageView>
            <telerik:RadPageView ID="rpv2" runat="server">
                <asp:TextBox ID="TextBox2"

    runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator

    ID="RequiredFieldValidator2" runat="server"

    ErrorMessage="RequiredFieldValidator"

    ControlToValidate="TextBox2">**</asp:RequiredFieldValidator>
                <br /><asp:Button ID="Button2" runat="server"

    Text="Button2"
                    onclick="Button2_Click" />
            </telerik:RadPageView>
        </telerik:RadMultiPage>


    And C# code :

    protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Write("button1");
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Write("button2");
        } 

  2. Answer
    Paul
    Admin
    Paul avatar
    4281 posts

    Posted 22 May 2008 Link to this post

    Hello Balan,

    Please find below your modified code snippet that works as expected.

    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0" MultiPageID="RadMultiPage1" CausesValidation="false">  
        <Tabs> 
            <telerik:RadTab runat="server" Text="Root RadTab1" Selected="true" PageViewID="rpv1">  
            </telerik:RadTab> 
            <telerik:RadTab runat="server" Text="Root RadTab2" PageViewID="rpv2">  
            </telerik:RadTab> 
        </Tabs> 
    </telerik:RadTabStrip> 
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">  
        <telerik:RadPageView ID="rpv1" runat="server">  
            <asp:TextBox ID="TextBox1" runat="server" ValidationGroup="but1"></asp:TextBox> 
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextBox1" ValidationGroup="but1">*</asp:RequiredFieldValidator> 
            <br /> 
            <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" ValidationGroup="but1" /> 
        </telerik:RadPageView> 
        <telerik:RadPageView ID="rpv2" runat="server">  
            <asp:TextBox ID="TextBox2" runat="server" ValidationGroup="but2"></asp:TextBox> 
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextBox2" ValidationGroup="but2">**</asp:RequiredFieldValidator> 
            <br /> 
            <asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" ValidationGroup="but2" /> 
        </telerik:RadPageView> 
    </telerik:RadMultiPage> 


    Best wishes,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top