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

prevent loading of second tab when there is error in the first tab

5 Answers 54 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Gopinath
Top achievements
Rank 2
Gopinath asked on 15 Mar 2012, 08:21 AM
Hi,

 I don't want to load the second tab when there is error in the first tab.

Below is my sample code


<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SIPlugInRCRAAIPermitContent.ascx.cs"
    Inherits="CGI.ESG.TEMPO.Web.ContentControls.SubjectItemDetails.SIPlugInRCRAAIPermitContent" %>
<%@ Register Src="~/ContentControls/SubjectItemDetails/RCRAAIPermitBaseOpContent.ascx"
    TagPrefix="OperationDatesandWasteStreams" TagName="RCRAAIPermitBaseOpContentControl" %>
<%@ Register Src="~/ContentControls/SubjectItemDetails/RCRAAIPermitBasePerContent.ascx"
    TagPrefix="ExistingPermitsandComments" TagName="RCRAAIPermitBasePerContentControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadTabStrip ID="rtsRCRAAIPermit" runat="server" Align="Left" MultiPageID="RadMultiPagertsRCRAAIPermit"
    SelectedIndex="0" AutoPostBack="true" OnTabClick="rtsRCRAAIPermit_TabClick">
    <Tabs>
        <telerik:RadTab Text="Operation Dates and Waste Streams" runat="server">
        </telerik:RadTab>
        <telerik:RadTab Text="Existing Permits and Comments" runat="server">
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage ID="RadMultiPagertsRCRAAIPermit" runat="server" SelectedIndex="0">
    <telerik:RadPageView ID="OperationDatesandWasteStreamsPage" runat="server">
        <OperationDatesandWasteStreams:RCRAAIPermitBaseOpContentControl ID="RCRAAIPermitBaseOpContentControl"
            runat="server" />
    </telerik:RadPageView>
    <telerik:RadPageView ID="ExistingPermitsandCommentsPage" runat="server">
        <ExistingPermitsandComments:RCRAAIPermitBasePerContentControl ID="RCRAAIPermitBasePerContentControl"
            runat="server" />
    </telerik:RadPageView>
</telerik:RadMultiPage> 

Code Behind Code :

protected void rtsRCRAAIPermit_TabClick(object sender, RadTabStripEventArgs e)
        {            
            switch (PrevTabText)
            {
                case "Operation Dates and Waste Streams":                    
                    this.Page.SavePage();                   
                    break;

                case "Existing Permits and Comments":                   
                    this.Page.SavePage();                 
                    break;

                default:
                    break;
            }            
        }

When  this.Page.SavePage();  even is successful. I want to load the second tab otherwise i don't want to load the second tab.

Can any please help me how to solve this.           

Thanks
Gopinath  
















5 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 19 Mar 2012, 12:19 PM
Hello Gopinath,

Since the TabClick event could not be canceled, you should manually preselect the previous selected tab if the SavePage method fails.

Greetings,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Gopinath
Top achievements
Rank 2
answered on 19 Mar 2012, 02:21 PM
Thank you Dimitar Terziev ,

 can you please provide me the sample code to do that.


Thanks
Gopinatn
0
Dimitar Terziev
Telerik team
answered on 22 Mar 2012, 04:33 PM
Hi Gopinath,

If the SavePage fails you could preselect the previous selected tab using the following code:
(sender as RadTabStrip).FindTabByText(PrevTabText).Selected = true;

Greetings,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Gopinath
Top achievements
Rank 2
answered on 27 Mar 2012, 08:08 AM
Thank you Dimitar Terziev , 

(sender as RadTabStrip).FindTabByText(PrevTabText).Selected = true; 

It just selecting the previous tab.

But i need the below two. 

1) previous user control has to loaded back 

2) previous tab should be selected. (this is done with your code)


Thanks
Gopinath
0
Dimitar Terziev
Telerik team
answered on 27 Mar 2012, 02:45 PM
Hello Gopinath,

Please add the following line of code in order to select the pageview of the previously selected tab:
(sender as RadTabStrip).FindTabByText(PrevTabText).PageView.Selected = true;

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TabStrip
Asked by
Gopinath
Top achievements
Rank 2
Answers by
Dimitar Terziev
Telerik team
Gopinath
Top achievements
Rank 2
Share this question
or