Re: Access UserControl

"Efran Cobisi, cobisi.com" <[email protected]> Fri, 9 May 2008 23:53:24 +0200
Newsgroups gmane.comp.windows.devel.dotnet.web
Organization cobisi.com
Message-ID <[email protected]>
>
> Could you tell me how to access the method of my UserControl ?

To access your user control methods from within its containing page
code, you should first make sure that the control itself has an ID
properly set; after that, ensure the methods or properties you'd like to
reach are public ones.
Given that, public members of your control should now be accessible
using its mapped istance variable, named after the ID you set previously.

[Page markup]
<custom:MyControl id="foo" runat="server" />

[User control code]
public void Bar() { // Method implementation }

[Page code]
foo.Bar();

HTH
--
Efran Cobisi
http://www.cobisi.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com