Click here to Skip to main content
Rate this: bad
good
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 1:24am
saj_211.1K

1 solution

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

Solution 1

Hi,
you can do something like this to set the scrollbar
 

 AjaxControlToolkit.TabContainer tcMain = new AjaxControlToolkit.TabContainer();
            tcMain.ID = "tcMain";
            string strTabName = "";
            try
            {
                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>";
                        pnlNew.Controls.Add(lcIframe);
                        tpNew.Controls.Add(pnlNew);
                        tcMain.Tabs.Add(tpNew);
                        i++;
                    }
                }
            }
catch (Exception ex)
            {   
                throw ex;
            }
        }
 
Let me know if you face any issue
  Permalink  
Comments
saj_21 at 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
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 210
3 Afzaal Ahmad Zeeshan 204
4 CPallini 185
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 28 Jan 2012
Copyright © CodeProject, 1999-2014
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