conditional user control

  • Thread starter Thread starter suzy
  • Start date Start date
S

suzy

hi,

how do i show/hide a user control depending on a condition. i can't write
an IF statement because im referencing the user control from html.

i am thinking of putting a panel control on my html instead of the
usercontrol, then adding the user control to it at runtime (depending on
condition). is this the best way?

thanks.
 
In class file, you declare usercontrol like
Protected WithEvents muControl As ucControl

Then, set it false.

muControl.Visible = False
 
Hi, Suzy, Paul

Suzy has mentioned that she needs to refer it in HTML code. If a server control is set to invisible, it will not be rendered to the client-side and can not be refered in client side scripting
You might try to add a panel and add your user control on it and then set the panel's style, like
Panel1.Style("visibility") = "hidden"
o
Panel1.Style("display") = "none

Bin Son
 
IIRC you can use LoadControl() to dynamically load a control, thereby making
it conditional.
 
Back
Top