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

6 posts, 0 answers
  1. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 15 Mar 2012 Link to this post

    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  
















  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 19 Mar 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 19 Mar 2012 Link to this post

    Thank you Dimitar Terziev ,

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


    Thanks
    Gopinatn
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 22 Mar 2012 Link to this post

    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.
  6. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 27 Mar 2012 Link to this post

    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
  7. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 27 Mar 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017