conditional user control

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.
 
P

Paul

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

Then, set it false.

muControl.Visible = False
 
G

Guest

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
 
C

Curt_C [MVP]

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

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top