gpt4 book ai didi

c# - 在代码隐藏中创建一个 ajaxToolkit TabPanel

转载 作者:太空宇宙 更新时间:2023-11-03 11:26:57 25 4
gpt4 key购买 nike

我有以下前端代码:

<ajaxToolkit:TabContainer runat="server" 
Height="150px"
Width="70%"
ActiveTabIndex="1"
OnDemand="true"
AutoPostBack="false"
TabStripPlacement="Top"
CssClass="myTabs"
ScrollBars="None"
UseVerticalStripPlacement="false"
ID="MyTabs"
>

<ajaxToolkit:TabPanel runat="server" HeaderText="Dummy" Enabled="false" Visible="false">
<ContentTemplate>
...
</ContentTemplate>
</ajaxToolkit:TabPanel>

<ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="Features & Benefits">
<ContentTemplate>
hey guys this is to hoping it works
</ContentTemplate>
</ajaxToolkit:TabPanel>


</ajaxToolkit:TabContainer>

有没有办法从代码隐藏中创建标签面板?

更新:

找到这个:

protected override void OnInit(EventArgs e) 
{
base.OnInit(e);

// Create the tab panel's content container
Control tabContent = new Control();

TabPanel tab = new TabPanel();
tab.ID = "tabPanel1";
tab.HeaderText = "Dynamic Panel";

Label label = new Label();
label.Text = "This is a dynamic tab panel";
tabContent.Controls.Add(label);
tab.Controls.Add(tabContent);
this.tabContainer1.Tabs.Add(tab);
}

在:http://forums.asp.net/t/1137736.aspx/1

最佳答案

像这样的东西?

TabPanel FirstTab= new TabPanel();  
FirstTab.ID = "Tab1";
FirstTab.HeaderText = "First Tab";

TabPanel SecondTab = new TabPanel();
SecondTab.ID = "Tab2";
SecondTab.HeaderText = "Second Tab";

TabContainer1.Tabs.Add(FirstTab); //add it to the Tab Container control
TabContainer1.Tabs.Add(SecondTab);

//to added content on it you can do like this
Image _image = new Image();
_image.ID = "image";
_image.ImageUrl = "~/images/test.gif";
FirstTab.Controls.Add(image);

TabContainer1.ActiveTabIndex = 0; // set your active tab index to display.

关于c# - 在代码隐藏中创建一个 ajaxToolkit TabPanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9005381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com