473,503 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Manipulating DIV from UserControl

I have a user control that is embedded into a <DIVtag in my aspx page. The
div tags visibility is set to true from the page when the user clicks on an
image. There is a user control within the div and I would like to hide (set
the visibility) the div once the user selects a date in the calendar that is
part of the user control. The div on the parent page has it's RunAt set to
"Server" so I should have no trouble referencing it but I can't figure out
how to from the user control within the div. Can anyone help?

Thanks in advance!
Jul 11 '07 #1
2 3593
HtmlGenericControl myDiv = this.Page.FindControl("myDiv");
myDiv.Visible=false;

(untested code, but you get the idea.) UserControls have a Page property
that returns a reference to the parent Page class.

-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder(BETA): http://www.blogmetafinder.com

"David Hearn" wrote:
I have a user control that is embedded into a <DIVtag in my aspx page. The
div tags visibility is set to true from the page when the user clicks on an
image. There is a user control within the div and I would like to hide (set
the visibility) the div once the user selects a date in the calendar that is
part of the user control. The div on the parent page has it's RunAt set to
"Server" so I should have no trouble referencing it but I can't figure out
how to from the user control within the div. Can anyone help?

Thanks in advance!
Jul 11 '07 #2
Thanks Peter!

"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:AF**********************************@microsof t.com...
HtmlGenericControl myDiv = this.Page.FindControl("myDiv");
myDiv.Visible=false;

(untested code, but you get the idea.) UserControls have a Page property
that returns a reference to the parent Page class.

-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder(BETA): http://www.blogmetafinder.com

"David Hearn" wrote:
>I have a user control that is embedded into a <DIVtag in my aspx page.
The
div tags visibility is set to true from the page when the user clicks on
an
image. There is a user control within the div and I would like to hide
(set
the visibility) the div once the user selects a date in the calendar that
is
part of the user control. The div on the parent page has it's RunAt set
to
"Server" so I should have no trouble referencing it but I can't figure
out
how to from the user control within the div. Can anyone help?

Thanks in advance!

Jul 11 '07 #3

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

Similar topics

2
7108
by: Dave Veeneman | last post by:
Is there a simple way to pass drag-and-drop events to a child control in a UserControl? Here's an example: I have created a UserControl which contains a treeview and some text boxes. I want to...
6
6643
by: Tom Rowton | last post by:
This one has me a bit confused and I'm not finding what I need in the MSDN or by searching these forums, so here goes... I have a rather large, complex code-in-page WebForm (don't ask) and a...
8
1946
by: Raed Sawalha | last post by:
Hi, I have a strange problem with a usercontrol on a page. The usercontrol dispalyes three categories (From a database) when the user clicks a category they see all the products in a shop for...
2
2230
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course...
2
4591
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation...
41
4237
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
12
2179
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
9
14418
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it...
6
12117
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use...
10
2395
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.