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

  • Home
  • SEARCH
  • 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 8249409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:32:05+00:00 2026-06-07T23:32:05+00:00

I have a series of controls (3 labels, 3 text boxes, and 2 buttons)

  • 0

I have a series of controls (3 labels, 3 text boxes, and 2 buttons) that are created when the user clicks a button on my page. The page does its postback with the commands that will generate these controls. However, when I fill in my textboxes and click one of the newly generated buttons (btnCreate), nothing happens, and the page just reloads once again.

What I want to happen is that when the user clicks btnCreate, it fires its function, and puts the TextBox.Text into a database. But again, when btnCreate is clicked, nothing happens.

Here is the code for the generated buttons (It’s the same function that generates the text boxes, which I’ve excluded here):

Protected Sub createSpecialNotes()
    Dim btnCreate As Button = New Button
    Dim btnClear As Button = New Button

    'Place properties

    lblSubject.Text = "subject"
    lblSubject.ID = "lblSubject"
    lblSubject.Width = 700
    lblAgenda.Text = "Agenda Note"
    lblAgenda.ID = "lblAgenda"
    lblAgenda.Width = 700
    lblMinutes.Text = "Minutes Note"
    lblMinutes.ID = "lblMinutes"
    lblMinutes.Width = 700

    btnCreate.Text = "Create"
    btnCreate.ID = "btnCreate"
    btnClear.Text = "Clear"
    btnClear.ID = "btnClear"

    'Add handlers for buttons
    AddHandler btnCreate.Click, AddressOf btnCreate_Click
    AddHandler btnClear.Click, AddressOf btnClear_Click

    plhCreateSpecialNotes.Controls.Add(btnCreate)
    plhCreateSpecialNotes.Controls.Add(btnClear)
End Sub

And for the sake of simplicity, let’s just say btnCreate needs only to display the textboxes’ contents.

Edit1: The call for create special notes is on page_preInit. It’s call consists of the following

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
    'Find the control that was fired
    Dim controlFired As Control = GetPostBackControl(Me.Page)

    If (controlFired IsNot Nothing) Then
        If (controlFired.ClientID.ToString() = "btnCreateSpecial") Then
            Call createSpecialNotes()
        End If
        If (controlFired.ClientID.ToString() = "btnCreate") Then
            'i've tried putting things here to no avail.
        End If
    End If

End Sub

The function getpostbackcontrol looks like this

    Public Shared Function GetPostBackControl(ByVal thePage As Page) As Control
    Dim myControl As Control = Nothing
    Dim ctrlName As String = thePage.Request.Params.Get("__EVENTTARGET")
    If ((ctrlName IsNot Nothing) And (ctrlName <> String.Empty)) Then
        myControl = thePage.FindControl(ctrlName)
    Else
        For Each Item As String In thePage.Request.Form
            Dim c As Control = thePage.FindControl(Item)
            If (TypeOf (c) Is System.Web.UI.WebControls.Button) Then
                myControl = c
            End If
        Next

    End If
    Return myControl
End Function

I hope this helps to clear things up as to why I’m having trouble.

  • 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-06-07T23:32:07+00:00Added an answer on June 7, 2026 at 11:32 pm

    What would be really useful here is to know when you’re calling createSpecialNotes(). But most probably what you are missing is the life-cycle of the page.

    Make sure createSpecialNotes() is called OnInit of your page. Anything after that is too late and your event handler won’t be fired.

    If OnLoad of your page is reached and you haven’t yet bound the handler to your control, then it won’t be fired.

    I recommend that you read this article carefully. http://msdn.microsoft.com/en-us/library/ms178472.aspx

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

Sidebar

Related Questions

I have a series of composite user controls that inherit from a base class
Greetings Overflow users, I created a series of custom ComboBox controls, that should have
I have a series of buttons and other controls. When the user presses the
I have a series of controls, but mostly textboxes and labels that need to
In a C#, Windows forms app, we have a series of user controls that
I have a series of controls on an ASP page. Some are inside an
i have a page with a series of checkboxes that authenticated users can change.
I have a series of dynamically created GridViews that I load. Everything works fine
I have created a MS Chart control on my page and added 2 series
We have a series of drop down controls that determine the sort order of

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.