1.
在设计图上
添加一个
TabContainer
控件
,
两个
UpdatePanel,
在
UpdatePanel
里加入
Label
和
Button
2,
在添加
TabPanel
控件时
,
在设计图中是添加不上去的
,
需要在
<cc1:TabContainer ID="TabContainer1" runat="server" Width ="260px" Height ="150px">
<ContentTemplate>
//TabPanel
代码
</ContentTemplate>//
记得加入这个否则会出错
</cc1:TabPanel>
Default.aspx
<%
@
Page
Language
="C#"
AutoEventWireup
="true"
CodeFile
="Default.aspx.cs"
Inherits
="_Default"
%>
<%
@
Register
Assembly
="AjaxControlToolkit"
Namespace
="AjaxControlToolkit"
TagPrefix
="cc1"
%>
<!
DOCTYPE
html
PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html
xmlns
="http://www.w3.org/1999/xhtml">
<
head
runat
="server">
<
title
>
Untitled Page
</
title
>
</
head
>
<
body
style
="">
<
form
id
="form1"
runat
="server">
<
asp
:
ScriptManager
ID
="ScriptManager1"
runat
="server"
/>
<
div
>
<
cc1
:
TabContainer
ID
="TabContainer1"
runat
="server"
Width
="260px"
Height
="150px">
<
cc1
:
TabPanel
ID
="TabPanel1"
runat
="server"
HeaderText
="Tabe1">
<
ContentTemplate
>
<
asp
:
UpdatePanel
ID
="UpdatePanel1"
runat
="server">
<
ContentTemplate
>
<
asp
:
Label
ID
="Label1"
runat
="server"
Text
="Label"></
asp
:
Label
><
br
/>
<
br
/>
<
asp
:
Button
ID
="btnOK"
runat
="server"
OnClick
="btnOK_Click"
Text
="
确定"
/>
</
ContentTemplate
>
</
asp
:
UpdatePanel
>
</
ContentTemplate
>
</
cc1
:
TabPanel
>
<
cc1
:
TabPanel
ID
="TabPanel2"
runat
="server"
HeaderText
="Tabe2">
<
ContentTemplate
>
<
asp
:
UpdatePanel
ID
="UpdatePanel2"
runat
="server">
<
ContentTemplate
>
<
asp
:
Label
ID
="Label2"
runat
="server"
Text
="Labe2"></
asp
:
Label
><
br
/>
<
br
/>
<
asp
:
Button
ID
="Button1"
runat
="server"
OnClick
="Button1_Click"
Text
="
确定"
/>
</
ContentTemplate
>
</
asp
:
UpdatePanel
>
</
ContentTemplate
>
</
cc1
:
TabPanel
>
<
cc1
:
TabPanel
ID
="TabPanel3"
runat
="server"
HeaderText
="Tabe3">
<
ContentTemplate
>
<
br
/><
br
/>
这是我第一个Tabs
<
br
/><
br
/>
<
a
href
=
http://blog.csdn.net/meng1986>
meng
</
a
>
</
ContentTemplate
>
</
cc1
:
TabPanel
>
</
cc1
:
TabContainer
></
div
>
</
form
>
</
body
>
</
html
>
Default.aspx.cs
public
partial
class
_Default
: System.Web.UI.
Page
{
protected
void
Page_Load(
object
sender,
EventArgs
e)
{
}
protected
void
btnOK_Click(
object
sender,
EventArgs
e)
{
this
.Label1.Text = "
这是Tab1"
;
}
protected
void
Button1_Click(
object
sender,
EventArgs
e)
{
this
.Label2.Text="
这是Tabl2"
;
}
}