For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > September 2004 > Re: How to access: a page from a User control, and another User control from anothe









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to access: a page from a User control, and another User control from anothe
Scott Allen

2004-09-30, 4:08 pm

A user control has a Page property you can use to get to the Page
containing the control.

WebForm1 form1 = (WebForm1)this.Page;

If the page then exposes the user controls as public properties or as
public fields (as you have done, it appears), you can reach them
through the page reference:

UC2 uc2 = form1.UC2

or

UC2 uc2 = ((WebForm1)this.Page).UC2;

HTH,

--
Scott
http://www.OdeToCode.com/

On Thu, 30 Sep 2004 12:55:06 +0300, qwerty <x@y.zzz> wrote:

>I have two User controls in a page.
>Them ID-propertys are example UC1 and UC2.
>
>In code behind file they are declared:
> Public UC1 As UC1
> Public UC1 As UC1
>
> From the page I can call them with their name (UC1 and UC2) and access
>their public propertys and functions.
>
>How can I access the page from a user control?
>How can I access another user control from another one?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com