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

TabStrip server validation.

1 Answer 50 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Silvio Silva Junior
Top achievements
Rank 2
Silvio Silva Junior asked on 22 Apr 2010, 08:25 PM
Hello guys.

In tabclick event how can I refuse to change tabs, based in a condition?

Regards.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 23 Apr 2010, 07:32 AM

Hello Silvio,

I guess you can accomplish the functionality by adding CustomValidator on page and check for the condition in the 'ServerValidate' event. Here is the code snippet that I tried for similar scenario.

ASPX:

 
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" AutoPostBack="True" OnTabClick="RadTabStrip1_TabClick"  
    SelectedIndex="1" CausesValidation="True" ValidationGroup="LoginValidationGroup">  
    <Tabs>  
      . . .  
    </Tabs>  
</telerik:RadTabStrip>  
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator"  
    ValidationGroup="LoginValidationGroup" OnServerValidate="CustomValidator1_ServerValidate">  
</asp:CustomValidator> 

C#:

 
    protected void RadTabStrip1_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)  
    {  
        if (Page.IsValid)  
        {  
            Response.Write("Valid");  
        }  
    }  
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)  
    {  
        if (TextBox1.Text == ""// Cehck for condition here  
        {  
            args.IsValid = false;  
        }  
    } 

-Shinu.

Tags
TabStrip
Asked by
Silvio Silva Junior
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or