How to save the data of dynamically created textbox on clicking the save button in asp.net?

save the data of dynamically created textbox on clicking the save button

I try and get solution is below:

Declared at the top:


Dim WithEvents txt As TextBox

Then write the below code:


Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txt = New TextBox
txt.Name = "tb1"
Controls.Add(txt)
End Sub

You can get the Text Of the textbox


Private Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
Dim a As String = Me.Controls("tb1").Text
MessageBox.Show(a)
End Sub
Save and Retrieve Dynamic TextBox values,How can save the dynamically created textbox value in database
How to create dynamic controls and save the values,Dynamically creating rows of textboxes

About the Author

avatar