Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > conditional user control

Reply
Thread Tools

conditional user control

 
 
suzy
Guest
Posts: n/a
 
      05-12-2004
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.



 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      05-12-2004

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

Then, set it false.

muControl.Visible = False



"suzy" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
>
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
Guest
Posts: n/a
 
      05-12-2004
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

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      05-12-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Set Conditional AutoPostBack In User Control rn5a@rediffmail.com ASP .Net 2 10-08-2006 11:36 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM
Manipulating a User Control from another User Control Tom Rowton ASP .Net 2 08-01-2003 08:18 PM



Advertisments