This is a migrated thread and some comments may be shown as answers.

Disable navigate URL function from RadTab

6 Answers 109 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Rodrigo Selada
Top achievements
Rank 1
Rodrigo Selada asked on 27 Jul 2009, 07:21 PM

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.

6 Answers, 1 is accepted

Sort by
0
Rodrigo Selada
Top achievements
Rank 1
answered on 30 Jul 2009, 08:44 AM
Telerik Team,

Is it possible?

Thanks.


Rodrigo S.
0
Accepted
Veselin Vasilev
Telerik team
answered on 30 Jul 2009, 10:59 AM
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.
0
Rodrigo Selada
Top achievements
Rank 1
answered on 30 Jul 2009, 04:51 PM

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.
0
Accepted
Paul
Telerik team
answered on 31 Jul 2009, 07:25 AM
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.
0
Rodrigo Selada
Top achievements
Rank 1
answered on 31 Jul 2009, 08:29 AM
OK. Thanks for the clear answer.


Regards,

Rodrigo Selada
0
Anu
Top achievements
Rank 1
answered on 28 Nov 2013, 10:26 AM
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
Tags
TabStrip
Asked by
Rodrigo Selada
Top achievements
Rank 1
Answers by
Rodrigo Selada
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Paul
Telerik team
Anu
Top achievements
Rank 1
Share this question
or