How to remove a control (ie textbox) from custom class


i have created a class with a sub, which removes a control from the original page…

for example, in the original page:

dim usertextbox as new textbox = "TEXTBOXIE"

in the class:

public sub DeleteTextBox
   dim pagetextbox as textbox
   pagetextbox = page.findcontrol("TEXTBOXIE")

   if not pagetextbox is nothing then
   end if
end sub

the code in the class doesn’t work… somebody can help me??
thx for the help! :smiley:

I see no reason Page.Controls.Remove(Page.FindControl(“TEXTBOXIE”)) wouldn’t work, unless the code is simply never being reached.

Use a breakpoint and step through it. See if the code is ever being called first, then see if the code that adds it is being called before or after this call.

thanks!! the problem are the tag EnablePartialRendering=“false”, in the scriptmanager declaration!