Click here to Skip to main content
13,087,797 members (80,127 online)
Rate this:
Please Sign up or sign in to vote.
Hello Friends,

I am creating Dynamic Tabs in web page. Tabs header and content are coming from database.

Sometimes my tab content has more in length so it increases the height of my tabpanel and it changes the alignment of other components on the page.

I want a scrollbar so that if the content goes more than the specific height then it will show the vertical scrollbar.

MY Problem Is:

I have tried a JQuery scroller for same but as my tabs are dynamically generating(i.e from database) but it never works for dynamically generated tabs. (It works for static div but not in tabs)

I Think following situation may creating the problem..I don't know whether it is right or wrong.
when my tabs get created it attaches Tabcontainername to Tabpanel so the tabpanel name changes in runtime. I think it creates a problem for JQuery to create Scroller at run time.

Can anybody suggest me how to do it????

Thanks in advance.
Shailesh Junghare.
Posted 24-Jan-12 0:24am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you can do something like this to set the scrollbar

 AjaxControlToolkit.TabContainer tcMain = new AjaxControlToolkit.TabContainer();
            tcMain.ID = "tcMain";
            string strTabName = "";
                if (ds.Tables[0].Rows.Count > 0)
                    short i = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                        strTabName = dr["tab_name"].ToString();
                        AjaxControlToolkit.TabPanel tpNew = new AjaxControlToolkit.TabPanel();
                        tpNew.ID="tb" + strTabName;
                        tpNew.TabIndex = i;
                        tpNew.HeaderText = strTabName;
                        Panel pnlNew = new Panel();

                        pnlNew.ScrollBars = ScrollBars.Vertical;

                        LiteralControl lcIframe = new LiteralControl();
                        lcIframe.Text = "<iframe name="" + strTabName + "" height="100%" width="100%" border="0" hold=" />                                        " frameborder="0" src="tabs/" + dr["file_path"].ToString() + <br mode="hold" />                                        dr["tab_main_page"].ToString() + "">test</iframe>";
catch (Exception ex)
                throw ex;

Let me know if you face any issue
saj_21 28-Jan-12 8:03am
thank you Aradhana. I'll give this a try and report my results.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 28 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100