I'm a newbie here and I'm stuck with the coding. So far I've created 3 buttons, first button is to load the values in textboxes added to placeholder. Then button2 is to extract the data from button 1 and display out. Now the 3rd step, I want to edit the values from the textboxes, after edit, how do I grab and display out the new values in label and textboxes?
Code:Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As Integer = 1 Dim message As String For x = 1 To 36 Dim txt As New TextBox 'txt.ID = "Text" & ViewState("COUNT") txt.ID = "Text" & x txt.Text = x.ToString PlaceHolder1.Controls.Add(txt) Next For x = 1 To 36 Dim stxt As String = "Text" & x.ToString Dim txtxx As TextBox = TryCast(PlaceHolder1.FindControl(stxt), TextBox) If txtxx IsNot Nothing Then 'There's your textbox value. message = message & txtxx.Text & "," End If Next 'Label1.Text = message Session("message") = message End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Label1.Text = Session("message") Dim x As Integer Dim message As String = "" For x = 1 To 36 Dim txt As New TextBox txt.ID = "Text" & x txt.Text = x.ToString PlaceHolder1.Controls.Add(txt) Next For x = 1 To 36 Dim stxt As String = "Text" & x.ToString Dim txtxx As TextBox = TryCast(PlaceHolder1.FindControl(stxt), TextBox) If txtxx IsNot Nothing Then 'There() 's your textbox value. message = message & txtxx.Text End If Next End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click End Sub End Class


Reply With Quote

