Ask a Question related to ASP.NET General, Design and Development.
-
John #1
Usercontrol interacting with it's parent page?
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.
John Guest
-
Restrict page access to parent page only (not by permissions)
I wish to restrict access of a pop-up page to parent page only. i.e. - if a request for "popup.cfm" comes from anywhere except "launch.cfm" then... -
dynamic userControl can't be accessed during page load
I have a userControl that I create based on how many rows I retrieve in a dataset. I add the control to my page but can't access it during the... -
Getting data from a usercontrol before containing page ends its page load
How do I load a user control in a web form first, so that the web form's page_load acts according to events on the user control? In my code... -
Abstract Base Page / UserControl
Our current solution has a number of ASP.NET pages with very similar functionality. We would like to move the common functions into a base class... -
Help: Usercontrol - different behaviors based on parent
I have a usercontrol that is basically a webapp-wide menu (dropdownlists, etc...) Is there a way I can program a certain dropdownlist in the uc... -
Vaibhav #2
Re: Usercontrol interacting with it's parent page?
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
"John" <a@b.com> wrote in message
news:OWS39NBQDHA.1336@TK2MSFTNGP11.phx.gbl...> 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.
>
>
Vaibhav Guest
-
Naveen K Kohli #3
Re: Usercontrol interacting with it's parent page?
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
[url]http://www.netomatix.com[/url]
"John" <a@b.com> wrote in message
news:OWS39NBQDHA.1336@TK2MSFTNGP11.phx.gbl...> 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.
>
>
Naveen K Kohli Guest
-
PJ #4
Re: Usercontrol interacting with it's parent page?
Mark the method public static and pass any necessary state information as
arguments.
~PJ
"John" <a@b.com> wrote in message
news:OWS39NBQDHA.1336@TK2MSFTNGP11.phx.gbl...> 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.
>
>
PJ Guest
-
Joe Agster #5
Usercontrol interacting with it's parent page?
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
of a page it is>-----Original Message-----
>Hi all,
>
>Is it possible for a usercontrol to call a public method>contained within? If so, how?
>
>Regards
>John.
>
>
>.
>Joe Agster Guest
-
Unregistered #6
Re: Usercontrol interacting with it's parent page?
On WebUserControl :-
Page page = HttpContext.Current.Handler as Page;
TextBox1.Text=(page.FindControl("") as TextBox).text.ToString();Unregistered Guest



Reply With Quote

