RadTabScript with Controls

2 posts, 0 answers
  1. Paloma Laderas Tirado
    Paloma Laderas Tirado  avatar
    1 posts
    Member since:
    Feb 2010

    Posted 11 Mar 2010 Link to this post

    Hi,

    I have problems with radTabScript , radMultiPage and Controls created for each tab

    CONTEXT:

    I have a "container" page called "Solutions.aspx" in which I need to add tabs (controls) with RadTabStrip and RadMultiPage.

    Solutions.aspx

    <tr> 
                        <td colspan="2">  
                            <div> 
                                <telerik:RadTabStrip ID="RadTabStripSolution" SelectedIndex="0" runat="server" MultiPageID="RadMultiPageSolution" 
                                    Skin="WebBlue" OnTabClick="RadTabStripSolution_TabClick">  
                                </telerik:RadTabStrip> 
                                <telerik:RadMultiPage ID="RadMultiPageSolution" runat="server" SelectedIndex="0" 
                                    OnPageViewCreated="RadMultiPageSolution_PageViewCreated" BorderWidth="1">  
                                </telerik:RadMultiPage> 
                            </div> 
                        </td> 
                    </tr> 

    Solutions.aspx.cs

    protected void Page_Load(object sender, EventArgs e)  
            {  
                //Get variables   
                loggedUser = (UserDTO)HttpContext.Current.Session["user"];  
     
                if (Request.QueryString["RetirementID"] != null)  
                    randaID = int.Parse(Request.QueryString["RetirementID"]);  
     
                if (!Page.IsPostBack)  
                {  
                    RetirementDTO retirement = new RetirementController().GetRetirementAllTabs(randaID);  
                      
                    WorkflowDTO wfRetirement = new WorkflowActions().ShowTabsLoad(loggedUser, retirement);  
                    if (wfRetirement != null)  
                    {  
                        int count = 0;  
                        foreach (WorkflowTabDTO wfTab in wfRetirement.Tabs)  
                        {  
                            AddTab(wfTab);  
                            if (wfTab.Selected)  
                            {  
                                RadTab tab = new RadTab(wfTab.TabName, wfTab.TabId.ToString());  
                                if(count <=0)  
                                AddPageView(tab);  
                            }  
                            count++;  
                        }  
                    }  
     
                    if (wfRetirement.Retirement != null)  
                    {  
                        // Retirement is locked  
                        if (wfRetirement.Retirement.Edited)  
                        {  
     
                            //Add session "edit" -> true, edit mode  
                            if (HttpContext.Current.Session["edit"] != null  
                                && !HttpContext.Current.Session["edit"].ToString().Equals(string.Empty))  
                            {  
                                HttpContext.Current.Session.Remove("edit");  
                            }  
                            HttpContext.Current.Session.Add("edit", true);  
     
                        }  
                        else  
                        {  
                            //Alert  
                            this.AlertEditPermission.Text = GetGlobalResourceObject("RANDAGlobalResource", "readPermissionAlert").ToString();  
                            this.PlaceHolderAlertEdit.Visible = true;  
                            //Add session "edit" -> false, view mode  
                            HttpContext.Current.Session.Add("edit", false);  
                        }  
                          
                }  
            }  
     
     
    protected void RadMultiPageSolution_PageViewCreated(object sender, RadMultiPageEventArgs e)  
            {  
                string userControlName = "../controls/" + e.PageView.ID + ".ascx";  
     
                //Control userControl = Page.FindControl(userControlName);  
                Control userControl = Page.LoadControl(userControlName);  
                //if (userControl == null)  
                //    userControl = Page.LoadControl(userControlName);  
                  
     
                userControl.ID = e.PageView.ID + "_userControl";  
                  
                if (e.PageView.FindControl(userControl.ID) == null)  
                {  
                    e.PageView.Controls.Add(userControl);  
                }  
     
            } 

     

    protected void RadTabStripSolution_TabClick(object sender, RadTabStripEventArgs e)  
            {  
                if (this.RadMultiPageSolution.FindPageViewByID(e.Tab.Text) == null)  
                    AddPageView(e.Tab);  
                e.Tab.PageView.Selected = true;  
            } 
    private void AddTab(WorkflowTabDTO tabWf)  
            {  
                RadTab tab = new RadTab(tabWf.TabName, tabWf.TabId.ToString());  
                tab.Enabled = tabWf.Enable;  
                tab.Selected = tabWf.Selected;  
                RadTabStripSolution.Tabs.Add(tab);              
            }  
     
            private void AddPageView(RadTab tab)  
            {  
                RadPageView pageViewCustom = new RadPageView();  
                pageViewCustom.ID = tab.Text;  
                if (this.RadMultiPageSolution.FindPageViewByID(tab.Text) == null)  
                //if (this.RadMultiPageSolution.FindControl(pageViewCustom.ID) == null)  
                {  
                    this.RadMultiPageSolution.PageViews.Add(pageViewCustom);  
                }  
                else 
                {  
                    this.RadMultiPageSolution.PageViews.Remove(pageViewCustom);  
                    this.RadMultiPageSolution.PageViews.Add(pageViewCustom);  
                }  
                //pageViewCustom.Enabled = tabWf.Enable;  
                tab.PageViewID = pageViewCustom.ID;  
                pageViewCustom.Selected = true


    Controls:
     - Register.ascx
     - Research.ascx
     - Agreement.ascx
     - PeriodicReview.ascx
     - Completion.ascx
     - Administration.ascx

    Example of Register.ascx:

    protected void nextButton_Click(object sender, EventArgs e)  
            {  
     
                RetirementDTO ret = new RetirementController().GetRetirementAllTabs(randaId);  
                  
                //Get the next Tab and give it the control  
                WorkflowTabDTO wfTab = new WorkflowActions().NextTab(ret, (int)TabEnum.REGISTER);  
                if (edit)  
                {  
                    if (SaveData())  
                    {  
                        UpdateLastTabModified((int)TabEnum.REGISTER);  
                        GoToNextTab(wfTab);  
                        GoToNextPageView(wfTab);  
                          
                    }  
                }  
                else 
                {  
                    GoToNextTab(wfTab);  
                    GoToNextPageView(wfTab);  
                }  
                  
            } 

     

    private void GoToNextTab(WorkflowTabDTO tab)  
            {  
                //Enable and select the next tab  
                RadTabStrip tabStrip = (RadTabStrip)Page.Master.FindControl("ContentPlaceHolder").FindControl("RadTabStripSolution");  
     
                RadTab nextTab = tabStrip.FindTabByText(tab.TabName);  
                nextTab.Enabled = tab.Enable;  
                nextTab.Selected = tab.Selected;  
     
            }  
     
            /// <summary>  
            /// Go to next page  
            /// </summary>  
            private void GoToNextPageView(WorkflowTabDTO tab)  
            {  
                //Go to next page  
                RadMultiPage multiPage = (RadMultiPage)Page.Master.FindControl("ContentPlaceHolder").FindControl("RadMultiPageSolution");  
                RadPageView nextPageView = multiPage.FindPageViewByID(tab.TabName);  
     
                if (nextPageView == null)  
                {  
                    nextPageView = new RadPageView();  
                    nextPageView.ID = tab.TabName;  
                    multiPage.PageViews.Add(nextPageView);  
                }  
     
                nextPageView.Selected = true;  
          } 


    First at all, I add all tabs (enable or not according to bussiness rule) and I select one of them as (tab.Selected = true).
    When tabs are enable, I can click on all of them and see them

    I can move between tabs in two ways:
      1º) Clicking into the Tab
      2º) Press the "SAVE&NEXT" button
      
    To set enable next tab and display it, I need to press "Save&Next" button and I need to Add into pageView the new Tab and load it.

    Attached: code files and screenshot of example.

    ISSUE/PROBLEM:

    When I try to pass from one tab (for example: RegisterTAB) to next tab (for example: ResearchTAB) on clicking on the Tab:
      - I can't load data into new selected TAB
      
    When I press "Save&Next" Button:
      - Next tab is not selected and data isn't loaded.
      
      
    SUMMARY:

    - New Tab is not selected
    - Data is not loaded
    - I can't see Radalert launch from Controls
    - When tab is changed, RadDecorator doesn't work (example: Buttons)

    See attached file.

    Please, I need to resolve these issues as soon as possible.

    Thanks in advance.

    Lorena

  2. Yana
    Admin
    Yana avatar
    5030 posts

    Posted 11 Mar 2010 Link to this post

    Hi Paloma ,

    I've already answered to the support ticket regarding the same issue.

    All the best,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top