|
-
Aug 8th, 2005, 10:52 PM
#3
Fanatic Member
Re: Dynamic controls disappear on click
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Me.IsPostBack Then
call btnOne_Click
end if
End Sub
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
Dim chkSample As New CheckBox
With chkSample
.Text = "I was added in the code"
.ID = "chkSample"
.EnableViewState = True
End With
pnlSample.Controls.Clear()
pnlSample.Controls.Add(chkSample)
pnlSample.EnableViewState = True
lblTalk.Text = "button ONE was clicked"
End Sub
Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click
lblTalk.Text = "button TWO was clicked"
End Sub
If a post has helped you then Please Rate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|