RadTab Multipage issue when set to invisible/visible

2 posts, 0 answers
  1. RICARDO
    RICARDO avatar
    2 posts
    Member since:
    Aug 2011

    Posted 17 Aug 2011 Link to this post

    Hi, I have a RadTab, and a Multipage that are generated Dinamically. When I call the function, GeneraInfoGeneral for the firs time works fine, but when another control sets the RadTab to visible=false; and the RadMultipage to visible=false, it only persists the pageView (visible), if I dont change between tabs.

    When I first click on btnInfoGral it works fine, but after I click btnServidorPublico and I clear tabs and clear pageViews, the pageview does not load until I click another tab. Im trying to set RadTab visible and invisible as its Multipage and pagesviews too.


    <telerik:RadTabStrip ID="RadTabInfoGral" runat="server"
                                           MultiPageID="RadMultiPage1" OnTabClick="RadTabInfoGral_TabClick"
                                           Orientation="HorizontalBottom" Skin="Default"
                                           Visible="False" OnClientTabSelecting="onTabSelecting" SelectedIndex="0" OnClientTabUnSelected="OnClientTabUnSelected"
                                              Align="Right">
                                       </telerik:RadTabStrip>
                                   
                                
                               <%--<telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0"
                                        Width="100%" OnTabClick="RadTabStrip1_TabClick" >
                                   <tabs>
                                       <telerik:RadTab runat="server" Selected="True" Text="Root RadTab1">
                                       </telerik:RadTab>
                                       <telerik:RadTab runat="server" Text="Root RadTab2">
                                       </telerik:RadTab>
                                   </tabs>
                               </telerik:RadTabStrip>--%>
                               <telerik:RadMultiPage
                               ID="RadMultiPage1" runat="server" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated"
                                        Width="100%" ScrollBars="Vertical" Height="430px" Visible="False" >
              </telerik:RadMultiPage>


    private void AddTab(string tabName)
      {
          RadTab tab = new RadTab();
          tab.Text = tabName;
          tab.SelectedImageUrl = "~/App_Themes/img/Informacion.gif";
          RadTabInfoGral.Tabs.Add(tab);
      }
     
      private void AddPageView(RadTab tab)
      {
     
     
          //BARRO cada lista de controles, y cuando coincide el nombre de la pestaña con el de la lista
          //me salgo del foreach, y le asigno al pageView.ID, el nombre que en la base de datos coincide con fcFileControlId,
          //se cargó previamente en la inicialización de controles.
          foreach (string[] list in (List<string[]>)ViewState["listControlesID"])
          {
              if (list[0].Equals(tab.Text))
              {
                  RadPageView pageView = new RadPageView();
                  pageView.ID = list[1];
                  RadMultiPage1.PageViews.Add(pageView);
                  tab.PageViewID = pageView.ID;
                  break;
              }
          }
     
      }
     
      protected void RadTabInfoGral_TabClick(object sender, RadTabStripEventArgs e)
      {
          AddPageView(e.Tab);
          e.Tab.PageView.Selected = true;
       }
     
      protected  void GeneraInfoGeneral()
      {
          //SI LE DAN CLICK EN EL BOTON DE INFORGRAL POR SEGUNDA VEZ MIENSTRAS ESTÉ MOSTRANDO
          if (!RadTabInfoGral.Visible)
          {
              RadTabInfoGral.Visible = true;
              //RadTabInfoGral.SelectedIndex = -1;
              PanelServidor.Visible = false;
     
              foreach (string[] StringArray in (List<string[]>)ViewState["listNombresPestañas"])
              {
                  AddTab(StringArray[2]);
              }
     
              RadMultiPage1.Visible = true;
              AddPageView(RadTabInfoGral.Tabs[0]);
     
     
          }
          
      }
     
     
     
      protected void anyImageButton_Click(object sender, ImageClickEventArgs e)
      {
          switch (((ImageButton)sender).ID)
          {
              case "btnServidorPublico":
                  PanelServidor.Visible = true;
                  RadTabInfoGral.Visible = false;
                  RadMultiPage1.Visible = false;
                  RadTabInfoGral.Tabs.Clear();
                  RadMultiPage1.PageViews.Clear();
                   
                  
                  break;
     
              case "btnInfoGral":
                  GeneraInfoGeneral();
                   
                   
                  
     
                  break;
     
              default:
                  break;
          }
     
      }
     

    protected void RadMultiPage1_PageViewCreated(object sender, Telerik.Web.UI.RadMultiPageEventArgs e)
       {
           string userControlName = "~/Controles/InformacionGeneral/" + e.PageView.ID + "CS.ascx";
           string URL = string.Empty;
           string jScript = " function Muestra_div(x) {" +
                            " if (document.getElementById(x).style.display == 'none')" +
                                   " { document.getElementById(x).style.display = 'block';  window.location.hash='#Link'+x;}" +
                            " else " +
                                   " document.getElementById(x).style.display = 'none';}" +
     
                            "function Oculta_Divs(ar){" +
                                   "for (i=0;i<ar.length;i++){" +
                                     " document.getElementById(ar[i]).style.display = 'none';}" +
                                     "}";
                            
     
           //string sUrlImagenFondo = string.Empty;
           Control userControl = Page.LoadControl(userControlName);
           userControl.ID = e.PageView.ID + "_userControl";
           cDevuelveDatos devuelveDatos = new cDevuelveDatos();
           devuelveDatos.UrlHTML((List<string[]>)ViewState["listArraytotal"], (List<string[]>)ViewState["listSubRubros"], e.PageView.ID);
     
           Literal literal1 = new Literal();
           literal1.ID = "Literal1";
           literal1.Text = devuelveDatos.sCadenaInformacion(Request.Url.Scheme + "://" + Request.Url.Host + Request.ApplicationPath,
                                                               Server.HtmlEncode(Request.PhysicalApplicationPath),e.PageView.ID);
     
           ScriptManager.RegisterStartupScript(userControl.Page, userControl.Page.GetType(),"Key", jScript, true);
           //literal1.Text += "<a href=\"#\" onclick=\"Muestra_div('"+e.PageView.ID+"DivPrincipal')\">dd</a>";
           userControl.Controls.Add(literal1);
           //((Literal)userControl.FindControl("literal01")).Text = literal1.Text;
           e.PageView.Controls.Add(userControl);
       }
  2. RICARDO
    RICARDO avatar
    2 posts
    Member since:
    Aug 2011

    Posted 17 Aug 2011 Link to this post

    In found how it can work thanks.
    I added  the pageViewSelected=true, in the method that sets invisible the RadTab and the MultipageView.

    RadTabInfoGral.Tabs.Clear();
    RadMultiPage1.PageViews[0].Selected=true;

    case "btnServidorPublico":
                   PanelServidor.Visible = true;
                   RadTabInfoGral.Visible = false;
                   RadMultiPage1.Visible = false;
                   //RadMultiPage1.PageViews.Clear();
                   RadTabInfoGral.Tabs.Clear();
                   RadMultiPage1.PageViews[0].Selected=true;
                   break
    ;

    And I also validate in the AddPageView method with this code.
     if (RadMultiPage1.Parent.FindControl(list[1])== null)
    {  RadMultiPage1.PageViews.Add(pageView); }


    private void AddPageView(RadTab tab)
        {
          foreach (string[] list in (List<string[]>)ViewState["listControlesID"])
            {
                if (list[0].Equals(tab.Text))
                {
                    RadPageView pageView = new RadPageView();
                    pageView.ID = list[1];
                 
                         
                    //HERE I VALIDATE THAT THE VIEW DOESNT EXISTS, THEREFORE IT SHOUD BE ADDED IN
                          //THE RADMULTIPAGE1.PAGEVIEWS OTHERWISE, ONLY THE TAB SHOULD HAVE THE PAGEVIEW ID
                    if (RadMultiPage1.Parent.FindControl(list[1])== null)
                        {

                            RadMultiPage1.PageViews.Add(pageView);
     
                        }
                                   
     
                    tab.PageViewID = pageView.ID;
                    break;
                }
            }
     
        }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top