By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,760 Members | 969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,760 IT Pros & Developers. It's quick & easy.

conditional user control

P: n/a
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.

Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

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

Then, set it false.

muControl.Visible = False

"suzy" <me@nospam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.

Nov 18 '05 #2

P: n/a
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

Nov 18 '05 #3

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

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"suzy" <me@nospam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.