We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Tab script add tab and remove tab

Thread ID:

Created:

Updated:

Platform:

Replies:

117222 Sep 10,2014 06:50 AM Sep 17,2014 01:13 AM ASP.NET Web Forms (Classic) 4
loading
Tags: TabStrip
Siang
Asked On September 10, 2014 06:50 AM

Is there any way to add tab or remove tab when click button?

Muralishankar Sundaram [Syncfusion]
Replied On September 11, 2014 08:50 AM

Hi Siang, 

Thank you for using Syncfusion products. 

Yes, By handling the Tabstrip object you can easily add and remove the tab manually. Please refer the following code snippet:

<code>

[CS]

protected void button2_Click(object Sender, Syncfusion.Web.UI.WebControls.Shared.ButtonAdvControl.ButtonAdvClickEventArgs e)

        {

            tab.Items.RemoveAt(tab.Items.Count-1);

        }

 

        protected void ButtonAdv1_Click(object Sender, Syncfusion.Web.UI.WebControls.Shared.ButtonAdvControl.ButtonAdvClickEventArgs e)

        {

            tab.Items.Add(new TabStripItem() { Text = "Sample" });

        }

</code>

we have attached the sample solution for add and remove tab action. 

Regards,

Muralishankar


Attachment: Tab_add_4918ce7b.zip

Siang
Replied On September 12, 2014 03:20 AM

How about if using tab strip with multi page?

Is there any sample?

Siang
Replied On September 15, 2014 04:39 AM

Hi, Muralishankar Sundaram

Actually I facing the problem when create new TabStripItem with a PageView.

When I click the button to create the TabStripItem with PageView at the first time, it worked ok.
However when I click the button second time or more, the TabStripItem is create but the PageView is replaced the previous PageView.

No matter how many times I click the button, only the Items in the TapStrip are increasing but the total PageView in the MultiPage keep remain at 1.

Here is my code.
-------------------------------------------------------------------------------------------------------------------------------------
[asp .net]
 <syncfusion:TabStrip ID="TabStripControl1" runat="server" Width="1024px" AutoFormat="Multiple Pages" MultiPageID="MultiPageControl1">
</syncfusion:TabStrip>                         
                                   
<syncfusion:MultiPage ID="MultiPageControl1" runat="server">
</syncfusion:MultiPage>

-------------------------------------------------------------------------------------------------------------------------------------
[CS]

int id = TabStripControl1.Items.Count + 1;

Label newLabel = new Label() { ID = "LabelControl"+id, Text = "Label"+id };

PageView newPageView = new PageView() { ID = "PageViewControl" + id };
newPageView.Controls.Add(newLabel);

MultiPageControl1.Controls.Add(newPageView);

TabStripItem newTabStripItem = new TabStripItem() { ID = "TabStripItemControl" + id, PageViewID = "PageViewControl" + id, Text = "Tab"+id};

TabStripControl1.Items.Add(newTabStripItem);

Muralishankar Sundaram [Syncfusion]
Replied On September 17, 2014 01:13 AM

Hi Siang, 

Sorry about the inconvenience caused. 

We are able to reproduce the reported issue "Multipage is not maintaining the pageview state on the post back" with Tab control. we have logged the reported issue  as defect and working on it. In order to get fix, please contact us at Syncfusion Support or you may also open a support ticket by login in to direct trac account and mention this forum link for reference. 

Kindly let us know if you have further queries.  

Regards,

Muralishankar 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;