Accessing a method in usercontrol from page or from other usecontrol.

  • Thread starter Thread starter Fernando Lopes
  • Start date Start date
F

Fernando Lopes

Hi.
How can I access a method in the code behind of a user control from the code
behind of a page or in the code behind of another usercontrol.
I change the method to public and now I access from the Page.
But, there is any problem using this way? (public method)
Anyone knows another way?
How can I access from another usercontrol?


Thanks.

Fernando
 
Fernando,
You can read my article on the topic here:
http://openmymind.net/communication/index.html

But you've pretty much done it the right way...the method must be public -
there's nothing bad about this. if you want, you can make it internal (c#)
or friend (vb.net) which will make it only accessible in your assembly - but
that's only really necessary if (a) you know what the hell i'm talking about
and (B) you are building some kind of api (and your API shouldn't be located
in your codebehind anyways).

karl
 
Thanks Karl.
Almost i'm in the right way. That's good!
I will read your article and, about internal, i know what the hell you're
talking and i'm not building any kind of api.

Thanks again.
Fernando
 
Back
Top