RadTabStrip Validation

4 posts, 0 answers
  1. Shawn
    Shawn avatar
    2 posts
    Member since:
    Jul 2011

    Posted 03 Aug 2011 Link to this post

    In my application, I'm using a RadTabStrip and a validation control to validate user input, but  when I switch tabs, and then click on a button, the first postback is ignored, but if I click twice it will postback.

    Any ideas?
    Thanks,
  2. Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    540 posts

    Posted 05 Aug 2011 Link to this post

    Hi Shawn,

    Can you attach / paste the snippets of the page -- one for the aspx file and one for the codebehind file?

    Regards,
    Ivan Zhekov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shawn
    Shawn avatar
    2 posts
    Member since:
    Jul 2011

    Posted 07 Aug 2011 Link to this post

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    namespace RadTabPostBack
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                MultiView1.SetActiveView(View1);
            }
     
            protected void RadTabStrip1_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)
            {
                if (RadTabStrip1.SelectedIndex == 0)
                {
                    MultiView1.SetActiveView(View1);
                }
                if (RadTabStrip1.SelectedIndex == 1)
                {
                    MultiView1.SetActiveView(View2);
                }
            }
        }
    }

    Hello Ivan

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="RadTabPostBack.WebForm1" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
     
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
            </telerik:RadScriptManager>
            <br />
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server"
                ontabclick="RadTabStrip1_TabClick" SelectedIndex="0">
                <Tabs>
                    <telerik:RadTab runat="server" Text="Tab1" Selected="True">
                    </telerik:RadTab>
                    <telerik:RadTab runat="server" Text="Tab2">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <asp:MultiView ID="MultiView1" runat="server">
                <asp:View ID="View1" runat="server">
                    <br />
                    Tab1 clicked   
                    <asp:Button ID="Button1" runat="server" Text="OK" />
                        
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                        ControlToValidate="TextBox1" ErrorMessage="<---- Type something here"></asp:RequiredFieldValidator>
                       
                    <asp:Button ID="Button3" runat="server" Text="Cancel" CausesValidation="False" />
                </asp:View>
                <asp:View ID="View2" runat="server">
                    <br />
                    Tab2 clicked   
                    <asp:Button ID="Button2" runat="server" Text="OK" />
                         
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                        ControlToValidate="TextBox2" ErrorMessage="<----Type Something here"></asp:RequiredFieldValidator>
                         
                    <asp:Button ID="Button4" runat="server" Text="Cancel" CausesValidation="False" />
                </asp:View>
     
            </asp:MultiView>
     
     
     
            <br />
         
        </div>
        </form>
    </body>
    </html>

    ,

     

    This is the simplified version of my problem.  If you leave the textbox blank and then click on one of the tabs then click on the cancel button, it will not postback for the first time, but if you click on the cancel button one more time it will post back.

  5. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 12 Aug 2011 Link to this post

    Hello Shawn,

    Please set the EnableClientScript of the RequiredFieldValidator to false.

    Best wishes,
    Helen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top