问题描述
您好,先生/女士,
我在Asp.net页面中有一个带有一个Tabpanel的TabContainer.当我从页面设计中修改tabPanel时,在< contentemplate>末尾的源代码中添加了一些不需要的代码.标签在该TabContainer中并显示错误.为什么这样做.请帮助我,并为我提供一个带解释的解决方案.
谢谢.
我的名为"TabContainer1"的TabContainer有一个名为"TabPanel1"的tabPanel.当我从页面的设计器修改它时,然后在源代码中自动添加相同的TabContainer和具有相同名称和相同ID的相同TabPanel,并在TabPanel的ContentTemplate标签正下方添加其他标签.
修改后,我的页面如下所示:
Hello Sir/madem,
I have a TabContainer with one Tabpanel in my Asp.net page.When i modify tabPanel from page design then some unwanted code are added in Source code just below the end of <contentemplate> tag in that TabContainer and show error.why does it do.please help me and suggest me a solution with explanation.
Thanks.
My TabContainer named "TabContainer1" have one tabPanel named "TabPanel1". When i modify it from Designer of page then in source Code automatically adds the same TabContainer and same TabPanel with Same Names and Same Ids and adds other tags just below the ContentTemplate tag of TabPanel.
After modifying it my page looks like this :
<div>
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="300px"
Width="950px" AutoPostBack="True">
<cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1" Height="300px">
<HeaderTemplate>
<span><font weight="Bold">Contact Details</font></span>
</HeaderTemplate>
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnlAddress" runat="server">
<table class="style4">
<tr>
<td colspan="2" align="center" class="tdLabel">
Permanent Adderess
</td>
<td colspan="2" align="center" class="tdLabel">
Temporary Address
</td>
</tr>
<tr>
<td class="tdLabel">
Adderess :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_perm_address" runat="server" TextMode="MultiLine"
Width="160px" CssClass="TextBoxStyle"></asp:TextBox>
</td>
<td class="tdLabel">
Address :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_temp_address" runat="server" TextMode="MultiLine"
Width="160px" CssClass="TextBoxStyle"></asp:TextBox>
</td>
</tr>
<tr>
<td class="tdLabel">
Country :
<td>
<asp:DropDownList ID="ddl_tabConDet_perm_country" runat="server" Width="140px" OnSelectedIndexChanged="ddl_tabConDet_perm_country_SelectedIndexChanged"
AutoPostBack="True" CssClass="DropDownStyle">
</asp:DropDownList>
</td>
<td class="tdLabel">
Country :
</td>
<td>
<asp:DropDownList ID="ddl_tabConDet_temp_country" runat="server" Width="140px" OnSelectedIndexChanged="ddl_tabConDet_temp_country_SelectedIndexChanged"
AutoPostBack="True" CssClass="DropDownStyle">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="tdLabel">
State :
</td>
<td>
<asp:UpdatePanel ID="upnlPermState" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:DropDownList ID="ddl_tabConDet_perm_state" runat="server" Width="180px" CssClass="DropDownStyle"
AutoPostBack="False">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_tabConDet_perm_country" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
<td class="tdLabel">
State :
</td>
<td>
<asp:UpdatePanel ID="upnlTempState" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:DropDownList ID="ddl_tabConDet_temp_state" runat="server" Width="180px" CssClass="DropDownStyle"
AutoPostBack="False">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_tabConDet_temp_country" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="tdLabel">
City :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_perm_city" runat="server" Width="180px"></asp:TextBox>
</td>
<td class="tdLabel">
City :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_temp_city" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="tdLabel">
Postal Code :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_perm_postcd" runat="server" Width="60px" onKeyUp="counter(this,6)"
onChange="counter(this,6)"></asp:TextBox>
</td>
<td class="tdLabel">
Postal Code :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_temp_postcd" runat="server" Width="60px" onKeyUp="counter(this,6)"
onChange="counter(this,6)"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td class="tdLabel">
Phone 1 :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_personal_no" runat="server" Width="150px" onKeyUp="counter(this,12)"
onChange="counter(this,12)"></asp:TextBox>
</td>
<td class="tdLabel">
Phone 2 :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_personal_no2" runat="server" Width="150px" onKeyUp="counter(this,12)"
onChange="counter(this,12)"></asp:TextBox>
</td>
</tr>
<tr>
<td class="tdLabel">
Personal Email :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_personal_email" runat="server" Width="150px"></asp:TextBox>
</td>
<td class="tdLabel">
Communication :
</td>
<td>
<asp:DropDownList ID="ddl_tabConDet_communication" runat="server" Width="148px" CssClass="DropDownStyle"
AutoPostBack="False">
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="4" align="left" class="tdLabel">
If both Addressess are Same:<asp:CheckBox ID="chkSameAddress" runat="server" OnCheckedChanged="chkSameAddress_CheckedChanged"
AutoPostBack="True" />
</td>
</tr>
<tr>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="chkSameAddress" EventName="CheckedChanged" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
<system.web.ui.control runat="server">
<span><font weight="Bold">Contact Details</font></span>
</system.web.ui.control>
<cc1:TabPanelContainer runat="server">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1">
<ContentTemplate>
<asp:Panel ID="pnlAddress" runat="server">
<table class="style4">
<tr>
<td colspan="2" align="center" class="tdLabel">
Permanent Adderess
</td>
<td colspan="2" align="center" class="tdLabel">
Temporary Address
</td>
</tr>
<tr>
<td class="tdLabel">
Adderess :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_perm_address" runat="server" TextMode="MultiLine"
Width="160px" CssClass="TextBoxStyle"></asp:TextBox>
</td>
<td class="tdLabel">
Address :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_temp_address" runat="server" TextMode="MultiLine"
Width="160px" CssClass="TextBoxStyle"></asp:TextBox>
</td>
</tr>
<tr>
<td class="tdLabel">
Country :
<td>
<asp:DropDownList ID="ddl_tabConDet_perm_country" runat="server" Width="140px" OnSelectedIndexChanged="ddl_tabConDet_perm_country_SelectedIndexChanged"
AutoPostBack="True" CssClass="DropDownStyle">
</asp:DropDownList>
</td>
<td class="tdLabel">
Country :
</td>
<td>
<asp:DropDownList ID="ddl_tabConDet_temp_country" runat="server" Width="140px" OnSelectedIndexChanged="ddl_tabConDet_temp_country_SelectedIndexChanged"
AutoPostBack="True" CssClass="DropDownStyle">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="tdLabel">
State :
</td>
<td>
<asp:UpdatePanel ID="upnlPermState" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:DropDownList ID="ddl_tabConDet_perm_state" runat="server" Width="180px" CssClass="DropDownStyle"
AutoPostBack="False">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_tabConDet_perm_country" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
<td class="tdLabel">
State :
</td>
<td>
<asp:UpdatePanel ID="upnlTempState" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:DropDownList ID="ddl_tabConDet_temp_state" runat="server" Width="180px" CssClass="DropDownStyle"
AutoPostBack="False">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_tabConDet_temp_country" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="tdLabel">
City :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_perm_city" runat="server" Width="180px"></asp:TextBox>
</td>
<td class="tdLabel">
City :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_temp_city" runat="server" Width="180px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="tdLabel">
Postal Code :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_perm_postcd" runat="server" Width="60px" onKeyUp="counter(this,6)"
onChange="counter(this,6)"></asp:TextBox>
</td>
<td class="tdLabel">
Postal Code :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_temp_postcd" runat="server" Width="60px" onKeyUp="counter(this,6)"
onChange="counter(this,6)"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td class="tdLabel">
Phone 1 :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_personal_no" runat="server" Width="150px" onKeyUp="counter(this,12)"
onChange="counter(this,12)"></asp:TextBox>
</td>
<td class="tdLabel">
Phone 2 :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_personal_no2" runat="server" Width="150px" onKeyUp="counter(this,12)"
onChange="counter(this,12)"></asp:TextBox>
</td>
</tr>
<tr>
<td class="tdLabel">
Personal Email :
</td>
<td>
<asp:TextBox ID="txt_tabConDet_personal_email" runat="server" Width="150px"></asp:TextBox>
</td>
<td class="tdLabel">
Communication :
</td>
<td>
<asp:DropDownList ID="ddl_tabConDet_communication" runat="server" Width="148px" CssClass="DropDownStyle"
AutoPostBack="False">
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="4" align="left" class="tdLabel">
If both Addressess are Same:<asp:CheckBox ID="chkSameAddress" runat="server" OnCheckedChanged="chkSameAddress_CheckedChanged"
AutoPostBack="True" />
</td>
</tr>
<tr>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="chkSameAddress" EventName="CheckedChanged">
</asp:AsyncPostBackTrigger>
</Triggers>
</asp:UpdatePanel>
<div>
</div>
</cc1:TabPanelContainer>
</cc1:TabPanel>
</cc1:TabContainer>
</div>
推荐答案
<asp:UpdatePanel ID="MyUpdatePanel1" runat="server">
<ContentTemplate>
<div>
<table>
<tr style="width: 100%; border-width: 1px; border-color: #c0c0c0;">
<td>
<ajax:TabContainer runat="server" ID="MyTabContainer" Height="407px" Width="720px" ActiveTabIndex="0" OnDemand="true"
AutoPostBack="false" TabStripPlacement="Top" CssClass="ajax__tab_xp" ScrollBars="None" UseVerticalStripPlacement="true"
VerticalStripWidth="120px">
<ajax:TabPanel ID="MyTabPanel1" runat="server" HeaderText="TAB-1" Enabled="true"
ScrollBars="Auto" OnDemandMode="Once">
<ContentTemplate>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="MyTabPanel2" runat="server" HeaderText="TAB-2" Enabled="true"
ScrollBars="Auto" OnDemandMode="Once">
<ContentTemplate>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
这篇关于C#Asp.net中的Ajax TabContainer问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!