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

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
 
K

Karl Seguin

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
 
F

Fernando Lopes

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top