Groups | Blog | Home
all groups > asp.net > july 2003 >

asp.net : Usercontrol interacting with it's parent page?


Vaibhav
7/1/2003 5:27:52 PM
Hi

Since your page is a class too. In your user control you can create an
instance of it and then call its method.

But i also doubt on this being the best way and only way to do what u want
to do.

HTH


[quoted text, click to view]

PJ
7/1/2003 5:47:27 PM
Mark the method public static and pass any necessary state information as
arguments.

~PJ

[quoted text, click to view]

Naveen K Kohli
7/1/2003 6:49:46 PM
Every Control has a property named "Page". This gives you the refrence to
the containing page object. YOu can call public methods through this
refrence.

--
Naveen K Kohli
http://www.netomatix.com
[quoted text, click to view]

Joe Agster
7/1/2003 8:38:01 PM
Yes, but you need to redefine the Page property from
within the user control to be of the type containing the
public method you want to access:

public class MyUC
inherits UserControl

protected readonly shadows property Page as MyPage
get
return ctype(mybase.Page, MyPage)
end get
end property

'... rest of class

'call method in containing page
Page.Method()

end class



[quoted text, click to view]
John
7/1/2003 10:02:51 PM
Hi all,

Is it possible for a usercontrol to call a public method of a page it is
contained within? If so, how?

Regards
John.

AddThis Social Bookmark Button