Delete Tab functionality when tab has been created dynamically

3 posts, 1 answers
  1. Shawn Currie
    Shawn Currie avatar
    11 posts
    Member since:
    Jul 2009

    Posted 29 Sep 2009 Link to this post

    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. Answer
    Yana
    Admin
    Yana avatar
    4841 posts

    Posted 30 Sep 2009 Link to this post

    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.
  3. Shawn Currie
    Shawn Currie avatar
    11 posts
    Member since:
    Jul 2009

    Posted 02 Oct 2009 Link to this post

    Hi Yana! After looking deeper into my code I figured out what my issue was.

    Thanks!
Back to Top