GoToNextTab() and GoToNextPageView() methods not working..

2 posts, 0 answers
  1. Cody
    Cody avatar
    4 posts
    Member since:
    Mar 2014

    Posted 31 Mar 2014 Link to this post

    Hello everyone,

    I've got a RadTabStrip and a RadMultiPage that both work together on one page and are supposed to toggled between pages, depending on certain events and conditions.

    My issue is that when i set them up, I can get the GoToNextTab() and GoToNextPageView() events to work when called on my first User Control (Step 1) but when attempting to call the method from my second User Control, the methods are unresponsive.

    Here are theTabStrip and MultiPage controls on the default.aspx web form...

    <!--Navigation Strip Menu-->
    <telerik:RadTabStrip ID="BillPayNavigationRadTabStrip" SelectedIndex="0" runat="server" MultiPageID="BillPayRadMultiPage" Align="Justify"
        Skin="Silk" CssClass="tabStrip" CausesValidation="false">
    </telerik:RadTabStrip>
     
    <!-- MultiPage  -->
    <telerik:RadMultiPage ID="BillPayRadMultiPage" runat="server" SelectedIndex="0" OnPageViewCreated="BillPayRadMultiPage_PageViewCreated"
        CssClass="multiPage" BorderWidth="1" BorderColor="#888888">
    </telerik:RadMultiPage>


    default.aspx code behind...

    protected void Page_Load(object sender, EventArgs e)
    {
        // Make sure we begin at Step 1 and disable the rest when the site loads for the first time.
        if (!Page.IsPostBack)
        {
            AddTab("Bill", true);
     
            RadPageView pageView = new RadPageView();
            pageView.ID = "Bill";
            BillPayRadMultiPage.PageViews.Add(pageView);
     
            AddTab("Provider", false);
            AddTab("Payment", false);
            AddTab("Confirmation", false);
            AddTab("Receipt", false);
        }
    }
     
    #region Navigation TabStrip and MultiPage handlers
     
    // This method adds the tabs to our Navigation TabStrip and assigns an appropriate background image
    private void AddTab(string tabName, bool enabled)
    {
        RadTab tab = new RadTab(tabName);
        tab.Enabled = enabled;
     
        switch (tab.Text)
        {
            case "Bill":
                tab.SelectedImageUrl = "Images/1_active.png";
                tab.ImageUrl = "Images/1_normal.png";
                break;
            case "Provider":
                tab.ImageUrl = "Images/2_normal.png";
                tab.SelectedImageUrl = "Images/2_active.png";
                tab.DisabledImageUrl = "Images/2_disable.png";
                break;
            case "Payment":
                tab.ImageUrl = "Images/3_normal.png";
                tab.SelectedImageUrl = "Images/3_active.png";
                tab.DisabledImageUrl = "Images/3_disable.png";
                break;
            case "Confirmation":
                tab.ImageUrl = "Images/4_normal.png";
                tab.SelectedImageUrl = "Images/4_active.png";
                tab.DisabledImageUrl = "Images/4_disable.png";
                break;
            case "Receipt":
                tab.ImageUrl = "Images/5_normal.png";
                tab.SelectedImageUrl = "Images/5_active.png";
                tab.DisabledImageUrl = "Images/5_disable.png";
                break;
            default:
                break;
        }
     
        BillPayNavigationRadTabStrip.Tabs.Add(tab);
    }
     
    // When the MultiPage control loads, look in the controls folder for each step page
    protected void BillPayRadMultiPage_PageViewCreated(object sender, RadMultiPageEventArgs control)
    {
        Control pageViewContents = LoadControl("controls/" + control.PageView.ID + ".ascx");
        pageViewContents.ID = control.PageView.ID + "userControl";
        control.PageView.Controls.Add(pageViewContents);
    }
     
    #endregion


    User Control 1 methods (these work)...
           protected void MedicBillTypeImage_Click(object sender, ImageClickEventArgs e)
           {
               Session["ProviderBillType"] = "medic";
               Session["PaymentStep"] = "2";
               GoToNextTab();
               GoToNextPageView();
           }
     
    #region Next Tab
            
           // Find and select the next Tab on our Navigation TabStrip
           private void GoToNextTab()
           {
               RadTabStrip tabStrip = (RadTabStrip)this.NamingContainer.FindControl("BillPayNavigationRadTabStrip");
               RadTab providerTab = tabStrip.FindTabByText("Provider");
               providerTab.Enabled = true;
               providerTab.Selected = true;
                
               RadTab paymentTab = tabStrip.FindTabByText("Payment");
               RadTab confirmationTab = tabStrip.FindTabByText("Confirmation");
               RadTab receiptTab = tabStrip.FindTabByText("Receipt");
               paymentTab.Enabled = confirmationTab.Enabled = receiptTab.Enabled = false;
           }
            
           #endregion
            
           #region Next Page
            
           //Find and load the next page in our MultiPage control
           private void GoToNextPageView()
           {
               RadMultiPage multiPage = (RadMultiPage)this.NamingContainer.FindControl("BillPayRadMultiPage");
               RadPageView providerPageView = multiPage.FindPageViewByID("Provider");
               if (providerPageView == null)
               {
                   providerPageView = new RadPageView();
                   providerPageView.ID = "Provider";
                   multiPage.PageViews.Add(providerPageView);
               }
               providerPageView.Selected = true;
           }
            
           #endregion


    User Control 2 Button Click event that calls methods, depending on conditions...
    protected void Step2SubmitButton_Click(object sender, EventArgs e)
            {
                bool failed = false;
                string providerCode = string.Empty;
                try
                {
                    if (Session["ProviderBillType"].ToString() == "medic")
                    {
                        if (MedicProviderOfServiceTextBox.Text != null)
                        {
                            providerCode = MedicProviderOfServiceTextBox.Text;
                            if (providerCode != null)
                            {
                                ConfirmProviderNameLabel.Text = CompanyNameByPC.GetCompanyNameByProviderCode(providerCode);
     
                                Step2ConfirmProviderPanel.Visible = true;
                            }
                            else
                            {
                                Step2ConfirmProviderPanel.Visible = false;
                            }
                        }
     
                        // did the user enter a provider code but not check the confirmation box?
                        if (!ConfirmProviderCheckbox.Checked)
                        {
                            failed = true;
                            UserMessageRadWindowManager.RadAlert("You must confirm your Provider before proceeding.", 330, 180, "Submission Error", "");
                        }
     
                        // if we failed then bail
                        if (failed)
                        {
                            return;
                        }
     
                        // we passed.  is the company using this new payment processor?  if not, redirect to
                        // the old payment page else set vars and move on.
                        if (!NppCheck.IsCompanyUsingNewPaymentProcessor(providerCode))
                        {
                            Session["ProviderCode"] = providerCode;
                            Session["PaymentStep"] = 1;
                            Response.Redirect("default2.aspx");
                            //Response.Redirect("https://www.qmacsmso.com/billpay.aspx?pc=" + providerCode + "&bt=" + Session["ProviderBillType"].ToString(), true);
                            return;
                        }
                        Session["ProviderName"] = ConfirmProviderNameLabel.Text;
                        Session["ProviderCode"] = providerCode;
     
                        // Go to the next PageView
                        GoToNextTab();
                        GoToNextPageView();
                    }
                    else if (Session["ProviderBillType"].ToString() == "myway")
                    {
    // The rest of the code follows the same pattern with "if else statements"
    // I've replaced the methods here with a simple popup window for testing and I've also replaced the method code with //  another popup to see if it is being called. Somehow, my NextTab and NextPage methods are unresponsive.

    User Control 2 Methods...

    #region Next Tab
     
    // Find and select the next Tab on our Navigation TabStrip
    private void GoToNextTab()
    {
        RadTabStrip tabStrip = (RadTabStrip)this.NamingContainer.FindControl("BillPayNavigationRadTabStrip");
        RadTab paymentTab = tabStrip.FindTabByText("Payment");
        paymentTab.Enabled = true;
        paymentTab.Selected = true;
    }
     
    #endregion
     
    #region Next Page
     
    //Find and load the next page in our MultiPage control
    private void GoToNextPageView()
    {
        RadMultiPage multiPage = (RadMultiPage)this.NamingContainer.FindControl("BillPayRadMultiPage");
        RadPageView paymentPageView = multiPage.FindPageViewByID("Payment");
        if (paymentPageView == null)
        {
            paymentPageView = new RadPageView();
            paymentPageView.ID = "Payment";
            multiPage.PageViews.Add(paymentPageView);
        }
        paymentPageView.Selected = true;
    }
     
    #endregion
  2. Cody
    Cody avatar
    4 posts
    Member since:
    Mar 2014

    Posted 01 Apr 2014 Link to this post

    Ok,
    It does seem that this issue was directly related to my Ajax loading panel and partial page load scripts. The controls that were supposed to trigger the NextTab and NextPageView are inside a <asp:Panel>. The Panel control essentially wraps the entire User Control contents, thus allowing a postback only within the <telerik:RadMultiPage> control. I imagine the Next Tab/Page methods were trying to look to the TabStrip and MultiPage controls (contained on the parent aspx form) but could not see beyond the <asp:Panel> control.

    Here is the asp.net code for User Control 2...
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Provider.ascx.cs" Inherits="Controls.ControlsProvider" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
     
    <!-- Ajax Manager -->
    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" OnAjaxRequest="RadAjaxManager_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="AsynchronousPanel" LoadingPanelID="RadAjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <!-- Wrap page in panel for partial page loads -->
    <asp:Panel ID="AsynchronousPanel" runat="server">
     
    <!-- Content-->
    <!-- Submit Button that is supposed to trigger GoToNextTab() and GoToNextPageView()-->
     
    </asp:Panel>
     
    <!-- Ajax Loading Panel -->
    <telerik:RadAjaxLoadingPanel MinDisplayTime="1000" ID="RadAjaxLoadingPanel" CssClass="RadAjaxLoadingPanel" runat="server" BackColor="White">
        <img src="../images/ajax-loader.gif" />
        <p>
            <i>One moment please...</i>
        </p>
    </telerik:RadAjaxLoadingPanel>
     
    <!--Call Scripts last to ensure that the page and styles load first-->
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function pageLoad(sender, eventArgs) {
                if (!eventArgs.get_isPartialLoad()) {
                    $find("<%= RadAjaxManager.ClientID %>").ajaxRequest("InitialPageLoad");
                }
            }
        </script>
    </telerik:RadCodeBlock>


    Code Behind for the AjaxRequest event
    protected void RadAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
        if (e.Argument == "InitialPageLoad")
        {
            // Occupy screen while content loads       
            System.Threading.Thread.Sleep(2000);
            AsynchronousPanel.Visible = true;
        }
    }

    As a solution, I'll just remove the AJAX loading panel for now, unless there is a way to allow the methods to look beyond the <asp:Panel> control to the parent aspx for for the <telerik:RadTabStrip> and <telerik:RadMultiPage> controls.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top