TabContainer cannot have children of type 'System.Web.UI.WebControls.TextBox'.

Bheta Hema 0 Reputation points
2023-02-21T17:50:37.84+00:00
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TabsContorl.aspx.cs" Inherits="Registrationform.TabsContorl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 
        <div>
      <asp:ScriptManager  ID="ToolkitScriptManager1" runat="server">  
        </asp:ScriptManager> 
        
           
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" Height="140px" Width="500px" AutoPostBack="true">  
            <cc1:TabPanel runat="server" HeaderText="Login Form" ID="TabPanel1">  
            </cc1:TabPanel>  
            <ContentTemplate> 
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </ContentTemplate>
            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Registration Form">  
            </cc1:TabPanel>  
        </cc1:TabContainer>
           </div>
    </form>
</body>


</html>

I have written code like above and now I am using Visual studio 2022.
Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 122.6K Reputation points
    2023-02-21T18:22:59.34+00:00

    Try putting the textbox inside the tab panel. For example:

    <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" Height="140px" Width="500px" AutoPostBack="true">  
       <cc1:TabPanel runat="server" HeaderText="Login Form" ID="TabPanel1">  
          <ContentTemplate> 
             <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
          </ContentTemplate>
       </cc1:TabPanel>  
       <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Registration Form">  
          <ContentTemplate> 
    
          </ContentTemplate>
       </cc1:TabPanel>  
    </cc1:TabContainer>
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.