473,506 Members | 17,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Call a User Control's Methods?

Hi,

I have a User Control dynamically loaded into a placeholder on my
webform. It contains a method, that I would like to call from the web
form? How can I do this?

Thanks,

Jim.

Nov 19 '05 #1
2 5743
MyUserControl control = (MyUserControl)Page.LoadControl("somepath.ascx");
control.MyFunction();

http://openmymind.net/index.aspx?documentId=9

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
<ji*********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,

I have a User Control dynamically loaded into a placeholder on my
webform. It contains a method, that I would like to call from the web
form? How can I do this?

Thanks,

Jim.

Nov 19 '05 #2
Jim
Hi, I can't seem to get any of the solutions provided in your tutorial
to work? I have a user control containing a public method.

I would like to call this method from the web form that dynamically puts
the control into a placeholder.

The two lines of code you seem to be saying do the job are:

5: Results r = (Results)Page.LoadControl("Results.ascx");
6: r.Info = SomeBusinessLayer.GetAllResults(); //valid

???

Any extra help on how I can achieve this would be much appreiciated....

Jim

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 19 '05 #3

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

Similar topics

7
2218
by: Byron | last post by:
I have several user controls that have a few methods in common, such LoadFromForm() which populates an object from controls on the form. I want to call that method from the form in which the...
4
4272
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
1
1006
by: Vannela | last post by:
I want to create some 100 user controls and write the common methods for all these user controls ,is this possible? Also i want to refer this user control and their methods on the aspx.cs file...
6
12261
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
2
1303
by: Bon | last post by:
Hello all How to call VB .NET components from user control? My folder structures are: the upper folder called Bon and then there are two sub-folders. One is called UserControls which is used...
12
7105
by: Tom | last post by:
I use dynamically created controls all the time. I.E. I create the control in code then use AddHandler to add the necessary delegates for processing (like Click, etc). Does one have to call...
2
5256
by: parkchan | last post by:
Hi everyone, I have a problem calling an event in a DLL from a C# code. The dll is written in VB.NET and I don't have the source code for it so I can't modify it. The DLL came with an aspx file...
3
3964
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
0
2809
by: germ | last post by:
I was trying to invoke a user control web method without much luck. I can move this same web method to the page and it works fine. I have seen some posts stating that you have to define the web...
4
3838
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I...
0
7220
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
7105
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
7371
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...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7479
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...
1
5037
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.