PlaceHolder Control Question...

R

Ralph Krausse

I have a sample at http://68.162.218.198/PlaceHolderTest/WebForm1.aspx.
I am trying to figure out how capture a button event when I
dynamically place a web user control in a placeholder control. I have
4 buttons that place a web user control in the placeholder, that all
works find. YOu click on the button and you will see that it gets
loaded. This web user control has a button in it but when I click on
it, the event doesn't get captured even there is an event defined with
in the web user control. When you click on the button in the Web User
Control, there is code to change the label above the button. But when
you click on it, the user control disappears. Now I can understand
that because the page gets recreated so my questions. Do I have to
remember that this user control was added and on any postback, put it
back? and how can I capture the button click on the web user control.




Thanks
Ralph Krausse

www.consiliumsoft.com
Use the START button? Then you need CSFastRunII...
A new kind of application launcher integrated in the taskbar!
ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
 
S

smay

You must reload the control in the placeholder in order for the click event
in the control's codebehind to fire.

Private Sub Page_Load...
If Not Page.IsPostBack Then
If Not Me.ViewState("ctrlPath") Is Nothing Then
PlaceHolder.Controls.Add(LoadControl(Me.ViewState("ctrlPath")));
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top