help with usercontrol

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
On a page I have a UserControl that I developed. I set this control visible
= false. How can I set the control visible=true based on the value of a
variable is met on the page?

Thanks
 
Hi,
That doesn't work. This is a custom user control. I tried this but didn't
work either

Dim test As Myctrl = CType(Page.LoadControl("Myctrl1.ascx"), Myctrl)
'test.Visible = True

Any ideas?
 
You need to declare your user control in your code behind before you can
reference it.
Protected WithEvents Myctrl As MyNamespace.MyControl

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
 
Hi,
On a page I have a UserControl that I developed. I set this control visible
= false. How can I set the control visible=true based on the value of a
variable is met on the page?

Thanks

How about?


bool testResult = somecondition ? true : false;

myControl.Visible = testResult;


-- ipgrunt
 
Back
Top