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

Need to set RadTabStrip TabClick

12 Answers 342 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Chad Johnson
Top achievements
Rank 1
Chad Johnson asked on 25 Jun 2009, 02:40 PM
Greetings,

I have a control called CCMNav.ascx, which contains a RadTabStrip.  There are 4 tabs within it, with each pointing at a different page.  I also have a MasterPage, CCMMaster.Master, which is where I placed CCMNav.ascx in to a ContentPlaceholder (cphContent1).  I then have another ContentPlaceholder (cphContent2), which is where the four pages are to be displayed.  The problem is, I need to add a TabClick event to the RadTabStrip so that when I select a tab, it calls up a method that will save the data to a Session variable.  Here is what I have thus far.

private void SetTabClickEvents()  
        {  
            ContentPlaceHolder con = (ContentPlaceHolder) Master.Master.FindControl("cphContent1");  
 
            if (con != null)  
            {  
                CCMNav nav = (CCMNav) con.FindControl("CCMNav");  
 
                if (nav != null)  
                {  
                    RadTabStrip tabs = (RadTabStrip) nav.FindControl("radCCMNav");  
 
                    if (tabs != null)  
                    {  
                        tabs.TabClick += SendCoPObjectToSession;  
 
                        //RadTab configurationTab = (RadTab) tabs.FindTabByText("Configuration");  
                        //RadTab displayTab = (RadTab) tabs.FindTabByText("Display");  
                        //RadTab knowareaTab = (RadTab) tabs.FindTabByText("Knowledge Areas");  
                        //RadTab modulesTab = (RadTab) tabs.FindTabByText("Modules");  
                    }  
                }  
            }  
        } 

This method is called during the Page_Load event.  Right now, it traces all the way in and does seemingly add the TabClick.  The problem is, when I click the tab, nothing happens.  The event is never fired.  Does anyone have any ideas?  I would be most appreciative if you do.  Thank you.

~Chad Johnson

12 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Jun 2009, 08:33 AM
Hi Chad Johnson,

You should check if you are always subscribing to the TabClick event. It will not work if you subscribe only on initial load (!Page.IsPostBack)

Regards,
Albert
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
Chad Johnson
Top achievements
Rank 1
answered on 26 Jun 2009, 01:32 PM
Here is what I have in the Page_Load.

protected void Page_Load(object sender, EventArgs e)  
{  
    SetTabClickEvents();  

This gets called, for I've traced through it, but when I click the tab, nothing still happens.  I'm at a loss to why it would not fire.
0
Atanas Korchev
Telerik team
answered on 26 Jun 2009, 01:48 PM
Hello Chad Johnson,

Please trace with the debugger whether this line
     tabs.TabClick += SendCoPObjectToSession; 

gets executed after postback.

Regards,
Albert
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
Chad Johnson
Top achievements
Rank 1
answered on 26 Jun 2009, 03:28 PM
The line is reached during Postback and non-Postback, so long as I am still on the page.  However, when I click one of the tabs, nothing is called.
0
Accepted
Atanas Korchev
Telerik team
answered on 26 Jun 2009, 04:16 PM
Hello Chad Johnson,

Do you set the NavigateUrl property of the tabs? If yes the TabClick event will never fire as clicking the tabs navigates instead of performing postback.

If this is not the case I would ask you to open a support ticket and send us your code so we can troubleshoot it.

Regards,
Albert
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
Chad Johnson
Top achievements
Rank 1
answered on 26 Jun 2009, 05:04 PM
I see, so if I have the NavigateUrl property set, the TabClick can never be fired.  I'll fix that and see what happens.  Thanks.
0
Paul
Telerik team
answered on 29 Jun 2009, 02:31 PM
Hello Chad,

The NavigateUrl property overrides the AutoPostBack property of the tabstrip and what happens in effect is simple URL page navigation (postback event never fires).

If you want to fire the postback, you need to remove the NavigateUrl property from the Tabs. If you still want to redirect after postback, move the URL from NavigateUrl property to Value property and use the Value to redirect. Example:


   protected void ReviewRadTabStrip_TabClick(object sender, TabStripEventArgs e)  
    {  
       Page.Response.Redirect(e.Tab.Value);  
    }  


Regards,
Paul
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Chad Johnson
Top achievements
Rank 1
answered on 29 Jun 2009, 02:36 PM
Thank you, both of you.  It was the NavigateUrl that was interfering with my TabClick events.  I now have it working.  Thanks once more.
0
Parimal Modi
Top achievements
Rank 1
answered on 11 Dec 2009, 12:58 PM
Hi,

I also have the same problem, but I can not use the Value field for redirection, because I've one more field, that needs to be set on Tab click. Is there any other field which can be used to carry this value.


Parimal Modi
0
AvastoneTech
Top achievements
Rank 1
answered on 14 Dec 2009, 04:02 AM
I have a similar problem, but the NavigateUrl property is not set for any of my tabs. The TabStrip is tied to a MultiPageView control, but I have the TabStrip set to postback on tab click so I can do some other work. When I hover over the tab, I see the URL of the page with "#" on the end down in the browser's status bar. When I click, nothing happens. It never posts back.

The really strange bit about this is that it had been working. This project is two months along now, and I need to demo it for the client! Now this suddenly stops working!

Tim
0
Veselin Vasilev
Telerik team
answered on 16 Dec 2009, 01:51 PM
Hi,

Can you please try to isolate the problem in a small page with static data? Paste here the relevant code so we can try to reproduce it locally. Thanks

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
AvastoneTech
Top achievements
Rank 1
answered on 16 Dec 2009, 05:02 PM
Thanks, Veselin.

I tracked this down to a required field validator in dynamic mode on one of the currently inactive tabs. The tabstrip would not post back, because it was stopping on the validator. I suppose I will need to make that validator static or even switch to serverside validation for that field. Or keep it disabled until the tab click and then use clientside code to enable it. Lots of options.

Tim
Tags
TabStrip
Asked by
Chad Johnson
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Chad Johnson
Top achievements
Rank 1
Paul
Telerik team
Parimal Modi
Top achievements
Rank 1
AvastoneTech
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or