This is a migrated thread and some comments may be shown as answers.

RadTabStrip Validation

3 Answers 155 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 03 Aug 2011, 09:11 AM
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,

3 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 05 Aug 2011, 01:19 PM
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.

0
Shawn
Top achievements
Rank 1
answered on 07 Aug 2011, 08:30 AM
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.

0
Helen
Telerik team
answered on 12 Aug 2011, 04:14 PM
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.

Tags
TabStrip
Asked by
Shawn
Top achievements
Rank 1
Answers by
Ivan Zhekov
Telerik team
Shawn
Top achievements
Rank 1
Helen
Telerik team
Share this question
or