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

Delete Tab functionality when tab has been created dynamically

2 Answers 55 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Shawn Currie
Top achievements
Rank 1
Shawn Currie asked on 29 Sep 2009, 02:58 PM
Hi Folks!

I have a page that has a tabstrip with multipage functionality. The tabs and the pageviews are created dynamically. To keep track of what tab and corresponding pageview should be selected I created a variable that holds a counter. Everytime a tab and pageview are created, I increment the counter. I then use this counter value to select the current tab and pageview after a post (selectindex = counter value). This works fine if the tabs and their corresponding pageviews aren't deleted. Once I introduced the functionality of removing tabs and their corresponding pageviews with the use of client code, my counter is useless.

I thought about creating a hidden form field that can be used to store a value that will represent the counter. When a new tab and corresponding pageview are to be created, I would update the hidden form field to hold the incremented selected index. When the tab and corresponding pageview are to be removed, I would include in my javascript a process to remove one from the counter. The counter really represents a value the is used to set my "selectedindex".

Hope this isn't too confusing... I'm really looking for the proper solution to implememt the adding and removing of tabs with a corresponding pageview that have been created dynamically.

Thanks!
Shawn

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 30 Sep 2009, 07:27 AM
Hi Shawn,

RadTabStrip is supposed to preserve its selected index so you don't need to set it manually. Or may be you've disabled the ViewState of the page? Could you please paste some simple code here so we to be able to understand the exact situation? Thanks

All the best,
Yana
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
Shawn Currie
Top achievements
Rank 1
answered on 02 Oct 2009, 02:41 PM
Hi Yana! After looking deeper into my code I figured out what my issue was.

Thanks!
Tags
TabStrip
Asked by
Shawn Currie
Top achievements
Rank 1
Answers by
Yana
Telerik team
Shawn Currie
Top achievements
Rank 1
Share this question
or