deleteing tab and pageview

18 posts, 0 answers
  1. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 22 Nov 2013 Link to this post

     i have create tab and alone with it's pageview .it's work fine for deleting i add close image button to another class .(i.e. add tab and pageview in one class and deleting tab in another class) tab is deleting but pageview of that tab is not delete.how can i delete tab alone with pageview.pls help me
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Nov 2013 Link to this post

    Hi Suresh,

    Please have a look into the following code snippet to delete both RadTab and RadPageView.

    ASPX:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"
        OnTabClick="RadTabStrip1_TabClick" AutoPostBack="true">
        <Tabs>
            <telerik:RadTab Text="Tab1" runat="server" PageViewID="RadPageView1">
            </telerik:RadTab>
            <telerik:RadTab Text="Delete Tab1" runat="server">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
        <telerik:RadPageView ID="RadPageView1" runat="server">
            <telerik:RadButton ID="RadButton1" runat="server" Text="Demo">
            </telerik:RadButton>
        </telerik:RadPageView>
    </telerik:RadMultiPage>

    C#:
    protected void RadTabStrip1_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)
    {
        if (e.Tab.Text == "Delete tab1")
        {
            RadTab tab = (RadTab)RadTabStrip1.FindTabByText("Tab1");
            // delete tab
            RadTabStrip1.Tabs.Remove(tab);
            RadPageView page = (RadPageView)RadMultiPage1.FindPageViewByID("RadPageView1");
            //delete pageview
            RadMultiPage1.PageViews.Remove(page);
        }
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 25 Nov 2013 Link to this post

    i have created multiple tab and there pageview .i want delete tab alone with pageview.pls help.
  5. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 25 Nov 2013 Link to this post

    I am creating tabs and page views dynamically using code. I am attaching the close button on which my tabs will be closed. I am uploading different content url for the pageviews. My question is when i am deleting a single tab the content url of other tabs are lost i.e the pageviews disappears.How can i preserve my pageviews. What code has to be written in
    protected void RadMultiPage1_PageViewCreated(object sender, Telerik.Web.UI.RadMultiPageEventArgs e)
    .
    My code is as follows:


    MY aspx page:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Result1.aspx.cs" Inherits="Result1" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <link href="Styles/teleriktab.css" rel="stylesheet" type="text/css" />
       


    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
       
        
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function onClientTabSelecting(sender, args) {
                    var tab = args.get_tab();
                    if (tab.get_pageView()) {
                        tab.set_postBack(false);
                    }
                }

            </script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1"  />
                      <%--  <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" />--%>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div class="exampleWrapper">
            
            <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop" Width="760"
                OnTabClick="RadTabStrip1_TabClick" MultiPageID="RadMultiPage1" Skin="Windows7"
                OnClientTabSelecting="onClientTabSelecting" SelectedIndex="0" >
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Width="760" Height="380" SelectedIndex="0"
                OnPageViewCreated="RadMultiPage1_PageViewCreated">
                <telerik:RadPageView ID="RadPageView1" runat="server">
        <%--<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadTabStrip1"> <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
               <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                    
                </UpdatedControls>
           </telerik:AjaxSetting>
           
        </AjaxSettings>
        </telerik:RadAjaxManager>--%>
         <%--<telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1" skin="Outlook" >
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" EnablePageHeadUpdate="true">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadTabStrip1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>--%>
       
       <%-- <telerik:RadTabStrip ID="RadTabStrip1" SelectedIndex="0" runat="server"  
     OnClientTabSelecting="onClientTabSelecting"  ClickSelectedTab="true"  Orientation="HorizontalTop"
        OnTabClick="RadTabStrip1_TabClick" ScrollChildren="True"
        ScrollButtonsPosition="Middle" PerTabScrolling="True"
            ScrollPosition="0" ShowBaseLine="True" Font-Size="8" MultiPageID="RadMultiPage1"  ForeColor="Blue" skin="Outlook" font-color="Blue" AutoPostBack="true"   >
        
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" Height="465px"
            onpageviewcreated="RadMultiPage1_PageViewCreated"  >
    </telerik:RadMultiPage>--%>
        </telerik:RadPageView>
            </telerik:RadMultiPage>
        </div>
        <div>
        
        </div>
        </form>
    </body>
    </html>



    And my code behind file is as follows:



    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using AjaxControlToolkit;
    public partial class Default2 : System.Web.UI.Page
    {
       
        //AjaxControlToolkit.TabContainer.tbcDyanamic;
        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (k == 1)
            {

              

            }
            if (!Page.IsPostBack)
            {
                RadTabStrip1.Tabs.Clear();

          
             
                for (int i = 1; i < 9; i++)
                {

                    RadTab tab = new RadTab();
                    tab.Text = "Result " + i;
                    tab.NavigateUrl = "Default2.aspx";
                    //tab.Text = "Result " + RadTabStrip1.Tabs.Count;
                    RadTabStrip1.Tabs.Add(tab);
                    //RadTabStrip1.Tabs.Insert(0, tab);
                    RadTabStrip1.SelectedIndex = tab.Index;

                    //RadTab tab = new RadTab();
                    //tab.Text = "Result " + i;
                    //  tab.Height = System.Web.UI.WebControls.Unit.Pixel(25);


                    tab.Value = "newTabValue";
                    //RadTabStrip1.Tabs.Insert(0, tab);
                    //tab.NavigateUrl = "Search.aspx";


                    RadPageView pageView = new RadPageView();
                    //tab.PageViewID = pageView.ID;
                    //Always assign the ID of the pageview
                    pageView.ID = "PageView" + Guid.NewGuid().ToString();
                    pageView.ContentUrl = ls[i];
                    RadMultiPage1.PageViews.Add(pageView);

                    //Call the DataBind method so any databinding expressions in the TabTemplate are evaluated ( <%# DataBinder.Eval (...) )
                    RadTabStrip1.DataBind();




                    //Add two tabs and two pageviews

                    //AddTabAndPageView();

                    //Call the DataBind method so any databinding expressions in the TabTemplate are evaluated ( <%# DataBinder.Eval (...) )
                    //RadTabStrip1.DataBind();
                }
              
            }
            else
            {
                
            }
        }
        //private void BindTabStripCloseButton()
        //{
        //    Default2 template = new Default2();
        //    foreach (RadTab tab in RadTabStrip1.GetAllTabs())
        //    {
                
        //        //template.InstantiateIn(tab);
        //    }
        //    RadTabStrip1.DataBind();

        //    //    //RadMultiPage1.PageViews.Clear();  
        //}
        protected void DeleteButton_Click(object sender, ImageClickEventArgs e)
        {
            dynamic clickedTab = (RadTab)((ImageButton)sender).Parent;
            DeleteTabAndPageView(clickedTab);
        }

        protected void Page_Init(object sender, System.EventArgs e)
        {
            //Create a new tabstrip and add it to the placeholder
            //RadTabStrip RadTabStrip1 = new RadTabStrip();
            RadTabStrip1.ID = "RadTabStrip1";
            RadTabStrip1.SelectedIndex = 0;
            PlaceHolder1.Controls.Add(RadTabStrip1);

            //Subscribe to the TabCreated event - in the event handler we will add the image button control
            RadTabStrip1.TabCreated += this.RadTabStrip1_TabCreated;

            //Create a new multipage and add it to the placeholder
            //RadMultiPage RadMultiPage1 = new RadMultiPage();
            RadMultiPage1.ID = "RadMultiPage1";
            RadMultiPage1.SelectedIndex = 0;
            PlaceHolder1.Controls.Add(RadMultiPage1);

            //Subscribte to the PageViewCreated event - in the event handler we will populate the pageview with controls
            RadMultiPage1.PageViewCreated += this.RadMultiPage1_PageViewCreated;


            //Wire up the tabstrip and the multipage
            RadTabStrip1.MultiPageID = "RadMultiPage1";

        }

        protected void RadTabStrip1_TabCreated(object sender, RadTabStripEventArgs e)
        {
            ImageButton button = new ImageButton();
            button.ImageUrl = "~/delete.gif";
            button.Click += this.DeleteButton_Click;

            e.Tab.Controls.Add(new LiteralControl(e.Tab.Text));
            e.Tab.Controls.Add(button);
        }


        //private void AddTabAndPageView()
        //{
            
        //}

        private void DeleteTabAndPageView(RadTab tab)
        {
            //Get the associated pageview
            RadPageView pageView = tab.PageView;
            //RadMultiPage1.PageViews.RemoveAt(RadMultiPage1.SelectedIndex);
            RadMultiPage1.PageViews.Remove(pageView);

            RadTabStrip1.Tabs.Remove(tab);
        }

        protected void RadMultiPage1_PageViewCreated(object sender, Telerik.Web.UI.RadMultiPageEventArgs e)
        {
            //Label target = (Label)sender;
            //RadTab tab = (RadTab)target.BindingContainer;
            //string tabText = (string)DataBinder.Eval(tab, "Text");
            //target.Text = tabText;
            Label pageViewContents = new Label();
            pageViewContents.ID = e.PageView.ID + "Label";
           // RadMultiPage1.SelectedIndex = e.PageView.TabIndex;
            //pageViewContents.Text = "PreviousPage" + e.PageView.TabIndex;
           //pageViewContents.Page ="http://www.blubaker.com";
            e.PageView.Controls.Add(pageViewContents);
        }

        //protected void AddTabButton_Click(object sender, System.EventArgs e)
        //{
        //    AddTabAndPageView();
        //}
        public void AddRemoveTabs()
        {
            Load += Page_Load;
            Init += Page_Init;
        }


       









    }
     
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Nov 2013 Link to this post

    Hi Suresh,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultipage1"
        OnTabCreated="RadTabStrip1_TabCreated">
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultipage1" runat="server" OnPageViewCreated="RadMultipage1_PageViewCreated">
    </telerik:RadMultiPage>

    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            for (int i = 0; i < 3; i++)
            {
                RadTab tab = new RadTab();
                tab.Text = "Tab" + i;
                tab.NavigateUrl = "Default3.aspx";
                RadTabStrip1.Tabs.Add(tab);
     
                RadPageView pageView = new RadPageView();
                pageView.ID = "PageView" + i;
                RadMultipage1.PageViews.Add(pageView);
            }
        }
    }
    protected void RadTabStrip1_TabCreated(object sender, RadTabStripEventArgs e)
    {
        ImageButton button = new ImageButton();
        button.ImageUrl = "~/plus.gif";
        button.Click += new ImageClickEventHandler(button_Click);
        e.Tab.Controls.Add(new LiteralControl(e.Tab.Text));
        e.Tab.Controls.Add(button);
    }
     
    void button_Click(object sender, ImageClickEventArgs e)
    {
        dynamic clickedTab = (RadTab)((ImageButton)sender).Parent;
        DeleteTabAndPageView(clickedTab);
    }
    private void DeleteTabAndPageView(RadTab tab)
    {
        RadPageView pageView = tab.PageView;
        RadMultipage1.PageViews.Remove(pageView);
        RadTabStrip1.Tabs.Remove(tab);
    }
    protected void RadMultipage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
    {
        //set the content url of the radpageview
        e.PageView.ContentUrl = "Grudandtab.aspx";
    }

    Let me know if you have any concern.
    Thanks,
    Shinu.
  7. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 26 Nov 2013 Link to this post

     hi shinu,
        it give same url to all pageview .my pageview url is different for different tab.
    protected void RadMultipage1_PageViewCreated (object sender, RadMultiPageEventArgs e)
    {
        //set the content url of the radpageview
        e.PageView.ContentUrl = "Grudandtab.aspx";
    }
    pls give me code for  this  RadMultipage1_PageViewCreated() .that give Different url according to tab click.
  8. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 26 Nov 2013 Link to this post

    My point is i when i am creating tabs, i am assigning different pageviews i.e different content url.
    for example, when my first tab is created it will display google page in pageview, on second tab it will display yahoo page and so on.
    The problem which i am facing is that when i delete the tab of pageview yahoo , the pageview of google disappears. How can i retain those pageviews?
     
    If i dont write the below code, my tabs are deleting but the last pageview is maintained. It doesnt disappear i.e all tabs are deleted but the pageview doesnt disappear. What would be the solution?



    protected void RadMultipage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
    {
        //set the content url of the radpageview
        e.PageView.ContentUrl = "Grudandtab.aspx";
    }
  9. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Nov 2013 Link to this post

    Hi Suresh,

    Please have a look into the following code snippet which works fine at my end.

    C#:
    // string array which holds the url
    string[] url = new string[] { "Default.aspx", "Default2.aspx", "Default3.aspx" };
    public int index = 0;
    protected void RadMultipage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
    {
        //set the content url of the radpageview
        e.PageView.ContentUrl = url[index];
        index++;
    }

    Thanks,
    Shinu.
  10. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 26 Nov 2013 Link to this post

    thanx Shinu for your post but what if the urls are dynamic. consider my example in which i provide a drop down list which has items like google , yahoo , etc. If i click on any item a new tab should open with the respective content i.e if i click on google a new tab with content as google page should open and like vice for yahoo. I can click on any item as many times as i can and each click should respond me with a new tab with the respective content. I have spent almost a month in doing his stuff and got stuck at this point. Please help me out.
  11. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 28 Nov 2013 Link to this post

    Hello Suresh,

    I had prepared a sample project for you, demonstrating a possible implementation, when selecting from a dropdown, in order to add dynamically RadTabs and the associated PageViews, along with their ContentUrl set. Would you give it a try at your end and let us know if this is the scenario you attempt to achieve. If not, please specify how your scenario differs and if you experience any issues, if the demonstrated approach is used.

    Note : dll files are removed from the attachment.

    Regards,
    Nencho
    Telerik
    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 the blog feed now.
  12. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 28 Nov 2013 Link to this post

      i am creating tab by using tabstrip with scrolling for multitab .when multiple tab is created like for e.g consider the no. of tabs as 14. initially the scrolling appears but when i  am deleting tab from 14,13, and so on at a point like when i am at tab 8 after deleting the scrolling disappears along with the starting tabs i.e tab1,tab2,tab3. Scrolling disappearing at a point is right but the starting tabs are hidden which causes a problem.

    <telerik:RadTabStrip ID="RadTabStrip1" SelectedIndex="0" runat="server"  
     OnClientTabSelecting="onClientTabSelecting"  ClickSelectedTab="true"  Orientation="HorizontalTop"
         ScrollChildren="True"  OnTabCreated="RadTabStrip1_TabCreated"
        ScrollButtonsPosition="middle"  PerTabScrolling="true"
            ScrollPosition="0"  ShowBaseLine="True"   Font-Size="8" MultiPageID="RadMultiPage1"  ForeColor="Blue"  font-color="Blue"  >
            </telerik:RadTabStrip>
  13. Mak
    Mak avatar
    1 posts
    Member since:
    Nov 2013

    Posted 28 Nov 2013 Link to this post

    Hi Shinu.
    Actually I am working with telerik ribbon and i got stuck at a point that if i want that i should show only particular ribbon header to particular user and disable rest.  And I should  show all ribbon header to specific user. Is it possible?
  14. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 29 Nov 2013 Link to this post

     i am creating tab by using tabstrip with scrolling for multitab .when multiple tab is created like for e.g consider the no. of tabs as 14. initially the scrolling appears but when i  am deleting tab from 14,13, and so on at a point like when i am at tab 8 after deleting the scrolling disappears along with the starting tabs i.e tab1,tab2,tab3. Scrolling disappearing at a point is right but the starting tabs are hidden which causes a problem.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

     

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <title></title>
        
        <link href="Style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
       <%-- <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
        <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />--%>
     
            <%--<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ScrollButtonsOptionsList">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                       
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="PerTabScrollingCheckBox">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                     
                    </UpdatedControls>
                </telerik:AjaxSetting>
               
            </AjaxSettings>
        </telerik:RadAjaxManager>--%>

        <div class="exampleWrapper">
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Width="400px" ScrollChildren="true" ScrollButtonsPosition="Middle" PerTabScrolling="true" ScrollPosition="0"
                SelectedIndex="0">
                <Tabs>
                    <telerik:RadTab Text="Advanced">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Automatic Updates">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Remote">
                    </telerik:RadTab>
                    <telerik:RadTab Text="General">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Computer Name">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Hardware">
                    </telerik:RadTab>
                    <telerik:RadTab Text="System Restore">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>

        </div>
     
       
     
      <%--  <div style="clear: both;"></div>--%>
     
       
        
     
        </form>
    </body>
    </html>

    my code behind file:

    using Telerik.Web.UI;

        public partial class Default2 : System.Web.UI.Page
    {
            protected void Page_Load(object sender, EventArgs e)
            {
                var tabTemplate = new TabTemplate();
                foreach (RadTab tab in RadTabStrip1.Tabs)
                {
                    tabTemplate.InstantiateIn(tab);
                }

            }
            protected void ScrollButtonsOptionsList_SelectedIndexChanged(object sender, EventArgs e)
            {
               // RadTabStrip1.ScrollButtonsPosition = (TabStripScrollButtonsPosition)Enum.Parse(typeof(TabStripScrollButtonsPosition), ((RadioButtonList)sender).SelectedValue);
               
            }
     
            protected void PerTabScrollingCheckBox_CheckedChanged(object sender, EventArgs e)
            {
                //RadTabStrip1.PerTabScrolling = ((CheckBox)sender).Checked;
                //RadTabStrip1.ScrollPosition = 0;
               
            }
            public class TabTemplate : ITemplate
            {
                public void InstantiateIn(Control container)
                {
                    Label label1 = new Label();
                    label1.ID = "ItemLabel";
                    label1.Text = (container as RadTab).Text;
                    container.Controls.Add(label1);
                    ImageButton imgRemove = new ImageButton();
                    imgRemove.Init += imgRemove_Init;
                    imgRemove.ID = "ImageButton1";
                    imgRemove.Width = Unit.Pixel(9);
                    imgRemove.Height = Unit.Pixel(9);
                    imgRemove.ImageUrl = "~/cut.png";
                    container.Controls.Add(imgRemove);
                }
                void imgRemove_Init(object sender, EventArgs e)
                {
                    ImageButton img = (ImageButton)sender;
                    img.Click += imgRemove_Click;

                }

                void imgRemove_Click(object sender, ImageClickEventArgs e)
                {
                    ImageButton img = (ImageButton)sender;
                    RadTab tab = img.Parent as RadTab;

                    tab.TabStrip.SelectedIndex = tab.Index - 1;
                  
                    tab.TabStrip.Tabs.Remove(tab);
                }
            }


            protected void ReorderTabsOnSelectCheckBox_CheckedChanged(object sender, EventArgs e)
            {
                
            }
        }



  15. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 30 Nov 2013 Link to this post

    Hi Mak,

    Please have a look into the following code snippet to hide the RadRibbonBarTab based on the user role.

    C#:
    if (Session["userrole"].ToString() == "guest")
    {
        RadRibbonBar1.FindTabByValue("1").Visible = false;
    }

    Thanks,
    Shinu.
  16. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 01 Dec 2013 Link to this post

     hi shinu
     i am creating tab by using tabstrip with scrolling for multitab .when multiple tab is created like for e.g consider the no. of tabs as 14. initially the scrolling appears but when i  am deleting tab from 14,13, and so on at a point like when i am at tab 8 after deleting the scrolling disappears along with the starting tabs i.e tab1,tab2,tab3. Scrolling disappearing at a point is right but the starting tabs are hidden which causes a problem. pls help me fast.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

     

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <title></title>
        
        <link href="Style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
       <%-- <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
        <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />--%>
     
            <%--<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ScrollButtonsOptionsList">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                       
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="PerTabScrollingCheckBox">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                     
                    </UpdatedControls>
                </telerik:AjaxSetting>
               
            </AjaxSettings>
        </telerik:RadAjaxManager>--%>

        <div class="exampleWrapper">
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Width="400px" ScrollChildren="true" ScrollButtonsPosition="Middle" PerTabScrolling="true" ScrollPosition="0"
                SelectedIndex="0">
                <Tabs>
                    <telerik:RadTab Text="Advanced">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Automatic Updates">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Remote">
                    </telerik:RadTab>
                    <telerik:RadTab Text="General">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Computer Name">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Hardware">
                    </telerik:RadTab>
                    <telerik:RadTab Text="System Restore">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>

        </div>
     
       
     
      <%--  <div style="clear: both;"></div>--%>
     
       
        
     
        </form>
    </body>
    </html>

    my code behind file:

    using Telerik.Web.UI;

        public partial class Default2 : System.Web.UI.Page
    {
            protected void Page_Load(object sender, EventArgs e)
            {
                var tabTemplate = new TabTemplate();
                foreach (RadTab tab in RadTabStrip1.Tabs)
                {
                    tabTemplate.InstantiateIn(tab);
                }

            }
            protected void ScrollButtonsOptionsList_SelectedIndexChanged(object sender, EventArgs e)
            {
               // RadTabStrip1.ScrollButtonsPosition = (TabStripScrollButtonsPosition)Enum.Parse(typeof(TabStripScrollButtonsPosition), ((RadioButtonList)sender).SelectedValue);
               
            }
     
            protected void PerTabScrollingCheckBox_CheckedChanged(object sender, EventArgs e)
            {
                //RadTabStrip1.PerTabScrolling = ((CheckBox)sender).Checked;
                //RadTabStrip1.ScrollPosition = 0;
               
            }
            public class TabTemplate : ITemplate
            {
                public void InstantiateIn(Control container)
                {
                    Label label1 = new Label();
                    label1.ID = "ItemLabel";
                    label1.Text = (container as RadTab).Text;
                    container.Controls.Add(label1);
                    ImageButton imgRemove = new ImageButton();
                    imgRemove.Init += imgRemove_Init;
                    imgRemove.ID = "ImageButton1";
                    imgRemove.Width = Unit.Pixel(9);
                    imgRemove.Height = Unit.Pixel(9);
                    imgRemove.ImageUrl = "~/cut.png";
                    container.Controls.Add(imgRemove);
                }
                void imgRemove_Init(object sender, EventArgs e)
                {
                    ImageButton img = (ImageButton)sender;
                    img.Click += imgRemove_Click;

                }

                void imgRemove_Click(object sender, ImageClickEventArgs e)
                {
                    ImageButton img = (ImageButton)sender;
                    RadTab tab = img.Parent as RadTab;

                    tab.TabStrip.SelectedIndex = tab.Index - 1;
                  
                    tab.TabStrip.Tabs.Remove(tab);
                }
            }


            protected void ReorderTabsOnSelectCheckBox_CheckedChanged(object sender, EventArgs e)
            {
                
            }
        }
  17. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 03 Dec 2013 Link to this post

    Hello Suresh,

    I was able to replicate the described issue, base on the provided code snippet and steps to reproduce. The bug is already forwarded to our developer team for further consideration. Thank you for pointing that out. We will do our best, in order to fix the issue as soon as possible.

    Regards,
    Nencho
    Telerik
    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 the blog feed now.
  18. Suresh
    Suresh avatar
    12 posts
    Member since:
    Nov 2013

    Posted 10 Dec 2013 Link to this post

     hi ,
       Any solution found to above problem.reply fast
  19. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 13 Dec 2013 Link to this post

    Hello Suresh,

    I am afraid that the issue has not been fixed yet. I would suggest you to track our release history for the fix release or I can simply update this thread, once the fix is available.

    Regards,
    Nencho
    Telerik
    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 the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017