Here is my code (After postback, I dynamically recreate the controls but
with some changes but the changes aren't reflected:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim Radio1 As RadioButton
Dim Radio2 As RadioButton
Dim TextBox1 As TextBox
If Not Me.IsPostBack Then
TextBox1 = New TextBox()
TextBox1.ID = "myTestBox1"
TextBox1.Text = "Before postback"
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(TextBox1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio1 = New RadioButton()
Radio1.ID = "myRadio1"
Radio1.Text = "Red"
Radio1.GroupName = "Color"
Radio1.Checked = False
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio2 = New RadioButton()
Radio2.ID = "myRadio2"
Radio2.Text = "Blue"
Radio2.GroupName = "Color"
Radio2.Checked = False
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio2)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Else
TextBox1 = New TextBox()
TextBox1.ID = "myTestBox1"
TextBox1.Text = "After postback"
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(TextBox1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio1 = New RadioButton()
Radio1.ID = "myRadio1"
Radio1.Text = "Red"
Radio1.GroupName = "Color"
Radio1.Checked = True
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio2 = New RadioButton()
Radio2.ID = "myRadio2"
Radio2.Text = "Blue"
Radio2.GroupName = "Color"
Radio2.Checked = True
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio2)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
End If
End Sub
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!