Disable navigate URL function from RadTab

7 posts, 2 answers
  1. Rodrigo Selada
    Rodrigo Selada avatar
    23 posts
    Member since:
    Nov 2008

    Posted 27 Jul 2009 Link to this post


    Hi!

    I have dynamic Tabs on my page, which I want to let the user close with the scroll wheel click from the mouse, as we can do to close tabs on the browser, for instance. The thing is that when I close a tab it opens the link http://<myUrl># on another tab. That's due to the browser behavior, which I can do nothing about it, and because I don't want to define an valid URL value for the tab... so she sets my page URL by default.

    How can I deactivate or set an empty URL so that the browser don't open a new tab on scroll wheel click over the radTab?


    Thanks,

    Rodrigo S.
  2. Rodrigo Selada
    Rodrigo Selada avatar
    23 posts
    Member since:
    Nov 2008

    Posted 30 Jul 2009 Link to this post

    Telerik Team,

    Is it possible?

    Thanks.


    Rodrigo S.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 30 Jul 2009 Link to this post

    Hello Rodrigo Selada,

    Can you please confirm whether you set the NavigateUrl property of the tabs?

    If not - this is rather strange - you can check our online demo for reference.

    Which browser do you test with?

    All the best,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Rodrigo Selada
    Rodrigo Selada avatar
    23 posts
    Member since:
    Nov 2008

    Posted 30 Jul 2009 Link to this post


    Dear Veselin Vasilev,

    In fact, your reference to the demo permitted me to analyse with better care the differences between my implementation and telerik example, wich I didn't noticed that the url wasn't set because it didn't have the close by wheel click feature and the problem don't exist.

    In telerik demo it doesn't have an navigate URL because tabs are defined by a template. Great :-) But I'm creating my tabs dynamically, on the client side by javascript, so the template solution don't apply :-( ... or I can't apply-it (it has to be databinded on the server side).

    So, despite your good answer, my problem maintains :\ By the way, I don't set any navigate URL and if I set one as empty or null, it gains the "<pageURL>#" by itself.

    Can I prevent the existence of the navigate URL and/or use the template from the client side?

    Here is my code:

     
        <script type="text/javascript"
            function CreateDynamicTabs() { 
                var names = new Array("Advanced", "Automatic Updates", "Remote", "General", "Computer Name", "Hardware", "System Restore"); 
     
                var _rts = $find("RadTabStrip1"); 
                if (!_rts) 
                    _rts = RadTabStrip1
     
                var _tab; 
                for (x in names) { 
                    _tab = new Telerik.Web.UI.RadTab(); 
                    _tab.set_text(names[x]); 
                    _tab.set_navigateUrl(''); 
                    _rts.get_tabs().add(_tab); 
                } 
                _tab.select(); 
                _rts._resize(); // to make the scroll buttons appear  
     
                return; 
            } 
     
            function OnMouseUpRadTabStrip(evt) { 
                var _tabTxt = event.srcElement.innerText; 
                if (_tabTxt.substr(_tabTxt.length - 1) == ' ') 
                    _tabTxt_tabTxt = _tabTxt.substr(0, _tabTxt.length - 2); 
     
     
                if (event.which == null) { /* IE case */ 
                    if (event.button == 4) { 
                        deleteTab(_tabTxt); 
                    } 
                } 
                else { /* All others */ 
                    if (event.which == 2) { // botão de scroll do rato 
                        deleteTab(_tabTxt); 
                    } 
                } 
            } 
     
            function deleteTab(_tabName) { 
                var tabStrip = RadTabStrip1.control; 
                var tab = tabStrip.findTabByText(_tabName); 
     
     
                var tabtabToSelect = tab.get_nextTab(); 
                if (!tabToSelect) 
                    tabtabToSelect = tab.get_previousTab(); 
     
                tabStrip.get_tabs().remove(tab); 
     
                if (tabToSelect) 
                    tabToSelect.set_selected(true); 
            } 
        </script> 
     
        <style type="text/css"
            .rtsUL 
            { 
                width: 10000px !important; 
                white-space: nowrap !important; 
            } 
        </style> 
     
    <body> 
        <form id="form1" runat="server"
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <div> 
            <input id="Button8" type="button" value="Create Dynamic Tabs" onclick="CreateDynamicTabs()" /><br /> 
     
            <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop" 
                Skin="WebBlue" SelectedIndex="0" Height="26px" Width="400px" ScrollChildren="True" 
                ScrollButtonsPosition="Middle"
                <TabTemplate> 
                    <%# DataBinder.Eval(Container, "Text") %> 
                    <img style="margin-left: 10px" src="Images/delete_14px.gif" alt="delete" onclick="deleteTab('<%# DataBinder.Eval(Container, "Text") %>')" /> 
                </TabTemplate> 
                 
            </telerik:RadTabStrip> 
        </div> 
        </form> 
    </body> 


        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                RadTabStrip1.Attributes.Add("onmouseup""OnMouseUpRadTabStrip(event);"); // TODO: Ver se tem de sair do !IsPostBack 
                RadTabStrip1.DataBind(); 
            } 
        } 


    Regards,

    Rodrigo S.
  6. Answer
    Paul
    Admin
    Paul avatar
    4281 posts

    Posted 31 Jul 2009 Link to this post

    Hi Rodrigo,

    Your requirement is currently not supported by the control. I'm afraid using the templates is the only solution we can offer for the moment.

    Regards,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Rodrigo Selada
    Rodrigo Selada avatar
    23 posts
    Member since:
    Nov 2008

    Posted 31 Jul 2009 Link to this post

    OK. Thanks for the clear answer.


    Regards,

    Rodrigo Selada
  8. Anu
    Anu avatar
    1 posts
    Member since:
    Nov 2013

    Posted 28 Nov 2013 Link to this post

    Hi Paul

    I have the same issue with respect to Sharepoint 2010. 
    But iam creating tabs server side. only tabstrip i have addeed through html.

    As this reply you have given in 2009, Is there a solution now for this?
    If so please help me in this.

    Regards
    Anu
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017