动态创建的TabPanel中的垂直滚动条, [英] Vertical Scrollbar in Dynamically Created TabPanel,

查看:113
本文介绍了动态创建的TabPanel中的垂直滚动条,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我正在网页中创建动态选项卡.标签页眉和内容均来自数据库.

有时我的选项卡内容会变长,因此会增加选项卡面板的高度,并会更改页面上其他组件的对齐方式.

我想要一个滚动条,以便如果内容超出特定高度,它将显示垂直滚动条.

我的问题是:

我已经尝试过使用相同的JQuery滚动条,但是由于我的标签页是动态生成的(即从数据库生成的),但它不适用于动态生成的标签页. (它适用于静态div,但不适用于制表符)

我认为以下情况可能会造成问题..我不知道这是对还是错.
创建我的选项卡时,它会将Tabcontainername附加到Tabpanel,以便选项卡名称在运行时更改.我认为这给JQuery在运行时创建Scroller带来了问题.

有人可以建议我怎么做吗?
提前谢谢.
Shailesh Junghare.

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.

推荐答案


您可以执行以下操作来设置滚动条


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


这篇关于动态创建的TabPanel中的垂直滚动条,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆