473,397 Members | 1,961 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,397 software developers and data experts.

How to reference method in usercontrol

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...
Nov 19 '05 #1
3 1061
dik (di*@lul.com) wrote in news:uE**************@TK2MSFTNGP10.phx.gbl:
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?

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Try a bit different syntax:
((MyControl)Panel1.FindControl("myusercontrol1")). test();

"dik" wrote:
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...

Nov 19 '05 #3
thanks Jouni
"Jouni Karppinen" <Jo************@discussions.microsoft.com> wrote in
message news:CE**********************************@microsof t.com...
Try a bit different syntax:
((MyControl)Panel1.FindControl("myusercontrol1")). test();

"dik" wrote:
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...

Nov 19 '05 #4

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

Similar topics

3
by: Tee | last post by:
Hi, I have a usercontrol with a overridable/virtual method. On the usercontrol onload, it will call this method. Now I have a form that have a few of this usercontrol. And I want to override...
4
by: Mark Friedman | last post by:
I can't seem to figure out how to get a reference to a UserControl in the code-behind for the page that contains the control. All the examples I've seen show how to pass property values from the...
1
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have...
5
by: Alphonse Giambrone | last post by:
How can I reference a page or user control's properties (such as viewstate) and controls from another class? TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
0
by: Matt Howeson | last post by:
I have a problem with a usercontrol that is dynamically loaded, from a web control and is not restoring it's viewstate properly. Here's the scenario. Within our content management system, I have...
7
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
11
by: Just Me | last post by:
I have a solution containing many usercontrol projects. When I wish to reference a usercontrol in another project I can select either the project or the assembly. Does it make a difference which...
1
by: Nathan Sokalski | last post by:
I have a UserControl that I declare programmatically as follows: Dim userctrl as New rightside_portal() The codebehind file for this UserControl looks like the following: Partial Public...
1
by: vishnu | last post by:
Hi, I am working on asp.net project which I converted the code fron VB to C# and instead of RaiseEvent in VB code I used the following code. using System; using System.Data; using...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.