473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

help with usercontrol

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
Nov 19 '05 #1
4 871
If MyValue = True Then MyControl.Visible = True

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
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

Nov 19 '05 #2
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?

"Steve C. Orr [MVP, MCSD]" wrote:
If MyValue = True Then MyControl.Visible = True

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
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


Nov 19 '05 #3
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
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
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?

"Steve C. Orr [MVP, MCSD]" wrote:
If MyValue = True Then MyControl.Visible = True

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:AE**********************************@microsof t.com...
> 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


Nov 19 '05 #4
"=?Utf-8?B?Q2hyaXM=?=" <Ch***@discussions.microsoft.com> confessed in
news:AE**********************************@microsof t.com:
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
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jose Michael Meo R. Barrido | last post by:
I made a custom runded rectangle usercontrol. I used a function i found on the internet. the function works fine(see "GetRoundRect" below). I use the fullowing code to make my usercontrol...
15
by: Tee | last post by:
Hi, I have a base usercontrol with a method (blank method, no code), I have another few usercontrols that will inherit this base usercontrol, but I want to force all the usercontrol that...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
2
by: Lau Lei Cheong | last post by:
Hello, I'm writing a usercontrol that contains a property named "disabled". It is set to false by default but there is also another button in the usercontrol that'll set it to true. On the...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
16
by: Merlin | last post by:
I have created a users control with a text box and button on it, what I want to do is override the usercontrol Keydown events with that of the Text box. What is the correct syntax to accomplish...
22
by: Colin McGuire | last post by:
I apologize for posting yet another scrollbar question. Here is my code. All I want is for a diagonal line to appear from coordinates (0,0) to (width,height) in a usercontrol regardless of whether...
1
by: Philipp Lenz | last post by:
I'm very confused about how this works, all the tutorials out there show me how to apply a skin to a webcontrol, but I want to know how I can access the components of a control....for example: I...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.