How to reference method in usercontrol

D

dik

Hi

I want to call a method called test() on my user control type MyControl (see below). The question is how to reference this? I tried :

(MyControl)(Panel1.FindControl("myusercontrol1")).test();

page:

<asp:panel id="Panel1" runat="server">
<TABLE id="Table1" runat ="server">
<TR>
<TD >
<uc1:myusercontrol id="myusercontrol1"runat="server"></uc1:myusercontrol>
</TD>
</TR>

</TABLE>
</asp:panel>

Thanks

Dik

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
L

Lucas Tam

dik ([email protected]) wrote in
Hi

I want to call a method called test() on my user control type
MyControl (see below). The question is how to reference this? I tried
:

(MyControl)(Panel1.FindControl("myusercontrol1")).test();


Did you declare test as a public method?
 
G

Guest

Try a bit different syntax:
((MyControl)Panel1.FindControl("myusercontrol1")).test();
 

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
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top