How to remove a user control dynamically

  • Thread starter Thread starter maflatoun
  • Start date Start date
M

maflatoun

Hi,

I have a user control that I add dynamically. Once certain action is
performed I want to remove it completely.

My questions are
1. How do you check to see if a user control already exists or not?
2. How do you remove it after it's been added?

I added by doing the following
Control ActivateOrderControl = LoadControl("activatelicense.ascx")
panelView.Controls.Add(ActivateOrderControl);

Thank you
Maz.
 
You can remove it the same way using remove instead of Add and perhaps a
findcontrol instead of the loop.
 

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

Back
Top