Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:26:56+00:00 2026-05-28T08:26:56+00:00

I’m developing a chat system. In this I’m creating dynamic tab panels in a

  • 0

I’m developing a chat system. In this I’m creating dynamic tab panels in a tab container when I change the selected index of the list box of users. In these tab panels I’m creating 2 text boxes and 1 button dynamically and adding a handler for the button click event. I’m storing the tabid’s in the session state and recreating all the tabs in the page_init event. I can fire the button click event in the tab panel, in which I’m unable to access these dynamically created text boxes but I can access a label which I created statically. I used the findcontrol() method but it is showing an error message: “Use new command to create the textbox instances”. It is showing something like I haven’t created the instances of textbox.

Any help is greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:26:57+00:00Added an answer on May 28, 2026 at 8:26 am

    Here is a complete working sample:

    Page-ASPX:

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" CombineScripts="true">
    </asp:ToolkitScriptManager>
    <div>
       <asp:UpdatePanel ID="UpdTabContainer" ChildrenAsTriggers="false" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
       <asp:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true">
            <asp:TabPanel ID="TabUserList" runat="server" HeaderText="UserList">
                <ContentTemplate>
                    <asp:UpdatePanel ID="UpdUserList" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:ListBox ID="ListBox1" SelectionMode="Single" AutoPostBack="true" OnSelectedIndexChanged="UserChanged" runat="server">
                                <asp:ListItem Text="User 1" Value="1"></asp:ListItem>
                                <asp:ListItem Text="User 2" Value="2"></asp:ListItem>
                                <asp:ListItem Text="User 3" Value="3"></asp:ListItem>
                            </asp:ListBox>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="TabContainer1" EventName="ActiveTabChanged" />
                        </Triggers>
                    </asp:UpdatePanel>
                </ContentTemplate>
            </asp:TabPanel>
        </asp:TabContainer>
        </ContentTemplate> 
        </asp:UpdatePanel>
    </div>
    

    Codebehind:

    Public Class TabContainerSample
        Inherits System.Web.UI.Page
    
        Property CreatedTabIDs As List(Of Int32)
            Get
                If Session("CreatedTabIDs") Is Nothing Then
                    Session("CreatedTabIDs") = New List(Of Int32)
                End If
                Return DirectCast(Session("CreatedTabIDs"), List(Of Int32))
            End Get
            Set(value As List(Of Int32))
                Session("CreatedTabIDs") = value
            End Set
        End Property
    
        Private Sub TabContainerSample_Init(sender As Object, e As System.EventArgs) Handles Me.Init
            For Each userID In CreatedTabIDs
                AddTab(userID)
            Next
        End Sub
    
        Private Sub AddTab(tabID As Int32)
            Dim ucLogin = DirectCast(Page.LoadControl("LoginControl.ascx"), LoginControl)
            ucLogin.UserID = tabID
            AddHandler ucLogin.LoggedIn, AddressOf userLoggedIn
            Dim newTabPanel = New AjaxControlToolkit.TabPanel
            newTabPanel.ID = String.Format("Tab{0}", tabID)
            newTabPanel.HeaderText = String.Format("TabPanel {0}", tabID)
            newTabPanel.Controls.Add(ucLogin)
            TabContainer1.Tabs.Add(newTabPanel)
        End Sub
    
        Protected Sub UserChanged(sender As Object, e As EventArgs)
            Dim tabID = Int32.Parse(DirectCast(sender, ListBox).SelectedValue)
            If Not CreatedTabIDs.Contains(tabID) Then
                AddTab(tabID)
                CreatedTabIDs.Add(tabID)
                Me.UpdTabContainer.Update()
            End If
        End Sub
    
        Private Sub userLoggedIn(login As LoginControl)
            ' do something '
        End Sub
    
    End Class
    

    The UserControl, for example a Login-Control:

    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="LoginControl.ascx.vb" Inherits="WebApplication1.LoginControl" %>
    <asp:UpdatePanel ID="UpdLoginControl" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
        User-ID: <asp:Label ID="LblUserID" runat="server" Text="0"></asp:Label>
        <br /><asp:TextBox ID="TxtUserName" runat="server"></asp:TextBox>
        <br /><asp:TextBox ID="TxtPassord" runat="server"></asp:TextBox>
        <br /><asp:Button ID="BtnLogin" runat="server" Text="Login" />
        </ContentTemplate>
    </asp:UpdatePanel>
    

    Codebehind:

    Public Class LoginControl
        Inherits System.Web.UI.UserControl
    
        Public Event LoggedIn(sender As LoginControl)
    
        Public Property UserID As Int32
            Get
                Return Int32.Parse(Me.LblUserID.Text)
            End Get
            Set(value As Int32)
                Me.LblUserID.Text = value.ToString
            End Set
        End Property
    
        Private Sub BtnLogin_Click(sender As Object, e As System.EventArgs) Handles BtnLogin.Click
            Dim userName = TxtUserName.Text
            Dim password = TxtPassord.Text
            ' validate UserName and Password, if valid you can raise your custom LoggedIn-Event'
            Dim loggedIn As Boolean = True
            If loggedIn Then
                RaiseEvent LoggedIn(Me)
            End If
            Me.UpdLoginControl.Update()
        End Sub
    End Class
    

    If you have further question, ask.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.