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

access tabstrip from usercontrol on tab

10 Answers 203 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 13 Jan 2010, 12:58 AM
I have a tabstrip on my page with several tabs and each tab has a usercontrol.
On one of my tabs based on a certain condition, I want to disable the other tabs.

Can you help me achieve this. I am unable to get a reference to the tabstrip from within the user control. I am using the latest build of ASP.NET AJAX controls.

Please help.

10 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 13 Jan 2010, 11:14 AM
Hi,

Here's an example of how to access the RadTabStrip from within the UserControl nested in its tab:
ascx.cs:
protected void Page_Load(object sender, EventArgs e) 
    { 
        UserControl user = (UserControl)sender; 
        RadTabStrip tabstrip = (RadTabStrip)(user.NamingContainer.FindControl("RadTabStrip1")); 
        foreach (RadTab tab in tabstrip.Tabs) 
        { 
            if (//custom condition) 
            { 
                tab.Enabled = false
            } 
        }       
    } 

Hope this helps..
Princy.
0
illumination
Top achievements
Rank 2
answered on 02 Dec 2010, 09:26 PM
I have tried to convert the cs code below to vb using telerik converter but it gave me this error:
CONVERSION ERROR: Code could not be converted. Details:
  
-- line 1 col 11: invalid TypeDecl
  
Please check for any errors in the original code and try again.
Will you provide me with the VB code version please?
Thank you.
0
Dimitar Terziev
Telerik team
answered on 08 Dec 2010, 09:04 AM
Hi Illumination,

This is the converted VB code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    Dim user As UserControl = DirectCast(sender, UserControl)
    Dim tabstrip As RadTabStrip = DirectCast(user.NamingContainer.FindControl("RadTabStrip1"), RadTabStrip)
    For Each tab As RadTab In tabstrip.Tabs
        If ("Custom Condition here") Then
            tab.Enabled = False
        End If
    Next
End Sub

All the best,
Dimitar Terziev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
illumination
Top achievements
Rank 2
answered on 08 Dec 2010, 02:50 PM
I got that working already. Thanks for the reply!
0
Spyros
Top achievements
Rank 1
answered on 11 May 2013, 12:42 PM
Hi,

Thanks for the solution above t solved half of my problem. The other half of the problem is that I want to enable the tabs from my button click event.How do I achieve that?
0
Kate
Telerik team
answered on 13 May 2013, 07:49 AM
Hi Spyros,

You can find the RadTabStrip control and use the foreach to go through all the tabs and set their Enable property to true.

Greetings,
Kate
the Telerik team
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 their blog feed now.
0
Spyros
Top achievements
Rank 1
answered on 13 May 2013, 08:11 AM
That's what I'am doing currently unfortunately ajaxfication prevents me of just looping and enabling the tab. 

So my next question is how do i achieve this with Ajax?
0
Kate
Telerik team
answered on 15 May 2013, 01:47 PM
Hello Spyros,

in general when using ajax on your page you can eaily enable/disable any control. Here I prepared a very simplified runnable page demonstrating the approach. When clicking on the second tab there are two buttons for enabling and disabling the tabs of the RadTabStrip control. Of course you can also further extend it to match your requirements.

Regards,
Kate
the Telerik team
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 their blog feed now.
0
Spyros
Top achievements
Rank 1
answered on 08 Jun 2013, 01:36 PM
Sorry for the late reply Kate and thank you for the sample project. This is not exactly my case. My radtabstrip is inside my aspx page so what I want to do is to enable/disable my tabs directly from my usercontrol but... ajax prevents this. I want to know a way to handle the ajax triggering for a control inside a content page from a child control (usercontrol). I dont know if this makes any sense.
0
Kate
Telerik team
answered on 13 Jun 2013, 11:04 AM
Hello Spyros,

I would kindly like to ask you to submit a support ticket where you can attach a simplified version of the project that  you are currently using, so I can help you out in your particular scenario. Thus, I would be able to assist you in the most efficient way.

Regards,
Kate
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.
Tags
TabStrip
Asked by
newbie
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
illumination
Top achievements
Rank 2
Dimitar Terziev
Telerik team
Spyros
Top achievements
Rank 1
Kate
Telerik team
Share this question
or