473,395 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
Nov 18 '05 #1
2 1163
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Fernando Lopes" <fe*******@remove.terra.com.br> wrote in message
news:ua*************@TK2MSFTNGP14.phx.gbl...
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

Nov 18 '05 #2
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
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e4**************@TK2MSFTNGP09.phx.gbl...
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

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Fernando Lopes" <fe*******@remove.terra.com.br> wrote in message
news:ua*************@TK2MSFTNGP14.phx.gbl...
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


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Earl Teigrob | last post by:
I am writing an application that dynamically loads user controls at run time based on user options. I would like to give my users the ability to build their own user controls and add them to my...
3
by: Craig G | last post by:
i have a user control which is basically a datagrid, which has add/edit/delete buttons on the grid is there anyway of accessing the actual datagrid from the form itself? basically i want to...
9
by: J055 | last post by:
Hi I have a standard asp page which uses a MasterPage. The MasterPage contains a User control. How can I access a public method in the User control from my WebForm page? I can't move the method...
4
by: =?Utf-8?B?R3JlZyBTdGV2ZW5z?= | last post by:
I have an ASP.NET page with a form that contains two user controls: <%@ Register TagPrefix="x" TagName="c1" Src="ctl1.ascx" %> <%@ Register TagPrefix="x" TagName="c2" Src="ctl2.ascx" %> <body>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.