Saturday, March 24, 2012

Tab Panel Problem.

Hi all,

I have a problem ... :) . I have a TabContainer palced on a page. This TabContainer is present inside a UpdatePanel. I have another updatePanel That contains LinkButtons. One of these when clicked causes the TabPanel to be added to the TabContainer with the help of the following code.

TabPanel tp =new TabPanel();tp.HeaderText ="Some Text";TabContainer1.Tabs.Add(tp);


The other links cause certain other Controls to be placed on the then active TabPanel of the TabContainer.

Button b =new Button();b.ID ="someid";b.Text ="SomeText";TabContainer1.ActiveTab.Controls.Add(b);


But When the number of these dynamically added TabPanels becomes more than two, the Contents of the TabPanels are not shown properly. For Example, If I have 3 TabPanels and on each panel I have a Button have text as button1, button 2 abd button3. Now when activetab is TabPanel1 I should see the button text as Button1, similarly for TabPanel2 and tabPanel3. But in my case the TabPanel contents are not shown properly.

Please Help me. What should I do??

Many Thanks.

sasmit

I think the issue is with the positioning of the tab controls and nothing wrong with the code.

Please see if you have hard coded any widths for the control in the source section on your .aspx file

Regards

Arfeen

qaziarfeen.blogspot.com

Please mark as answered if you think its the right solution


i Don't know how it worked but it did... :)

The only change I did was to remove the Hard coded TabPanel inside the TabContainer and if magic it started working correctly. I'll Explain... I had a TabContainer placed inside a UpdatePanel. In this TabContainer I had placed a TabPanel [this was the hard coded panel the I removed]. I Kept adding the TabPanels dynamically as and when needed.

The problem was that the Content was not updated even if the active tab changed.

I removed the harded coded control and It is working fine now.

Cheers :)

No comments:

Post a Comment