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. Image for the cookie policy date

Facing problems when i add tabs dynamically from code.

HI,

I am having a requirement wherein i want to add the tabs based upon users selection dynamically thrugh code. I created a TABSTRIP with a default tab and a MULTIPAGE with a default page and gave a dropdown wherein user selects the value and click add tab button.

PROBLEM: When i click on the ADD TAB button first time the tab is getting created with the page but consequent clicks erases the old Pages.

heres my code

private bool CreateTab(string e)
{
if (!CartTabStrip.Items.Contains("Tab_"+ e))
{
TabStripItem TabItem = new TabStripItem();
TabItem.Text = e;
TabItem.ID = "Tab_" + e;
TabItem.PageViewID = "Page_" + e;
CartTabStrip.Items.Add(TabItem);
return true;
}
else
{
return false;
}
}


private void CreatePage(string e)
{
PageView TabPage = new PageView();
TabPage.ID = "Page_" + e;

TextBox text = new TextBox();
text.Text = e;

TabPage.Controls.Add(text);

CartTabs.Pages.Add(TabPage);
}


5 Replies

RP Rekha P Syncfusion Team October 28, 2008 12:42 PM UTC

Hi Subbu,

Thank you for your interest in Syncfusion Products.

Please refer the below link for sample files which illustrates your requirement,
http://websamples.syncfusion.com/samples/Tools.Web/F77307-TabStrip.zip

Please let me know if this sample helps you.

Thanks,
Rekha



SB Subramanya Bhat October 30, 2008 06:39 AM UTC

Thanks Rekha,

It helped.

But the problem is not solved fully.

1) This solution doesnt work if i put the menu control inside the Update Panel control to acheive Ajax Functionality.

2) What if the multipage is having a Gridgrouping control instead of textbox. How will you maintain the state of the existing controls.



RP Rekha P Syncfusion Team November 1, 2008 09:16 AM UTC

Hi Subbu,

Thank you for being patient.

Regarding,
1) This solution doesnt work if i put the menu control inside the Update Panel control to acheive Ajax Functionality.
Please refer the below link for sample files which illustrates the working of Menu control inside the UpdatePanel,
http://websamples.syncfusion.com/samples/Tools.Web/F77307-Menu-Updatepanel.zip

2) What if the multipage is having a Gridgrouping control instead of textbox. How will you maintain the state of the existing controls.
Please refer the workaround sample containing a Gridgrouping control in PageView along with the video clip,
http://websamples.syncfusion.com/samples/Tools.Web/F77307-PageView-GGC.zip

Please let me know if you have any concerns.

Thanks,
Rekha



AK Ali Kaslan July 6, 2015 09:11 AM UTC

Hi,
I m facing the same problem,
Old pages are lost when i add a new one.
How can i solve this problem

Thanks


ES Ezhil S Syncfusion Team July 8, 2015 12:40 PM UTC

Hi Ali,

Thank you for contacting Syncfusion support.

We are unable to reproduce the issue reported that the pages are lost on adding newer pages from code behind. Kindly ensure whether you have provided unique ID for the PageView created dynamically. We have prepared a sample that allows you to add new TabItem integrated with new PageView created dynamically. Please check whether the issue reproduces in the shared sample. If not modify the sample to reproduce the issue at our end so that we can provide you an alternative solution.
Sample link: http://www.syncfusion.com/downloads/support/forum/77307/ze/Tab_add_773071899672768
Please let us know if you have any queries.

Regards,
Ezhil S

Loader.
Live Chat Icon For mobile
Up arrow icon