Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

How to Call a User Control's Methods?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jimfkennedy@gmail.com - 20 Jul 2005 13:44 GMT
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.
Karl Seguin - 20 Jul 2005 14:00 GMT
MyUserControl control = (MyUserControl)Page.LoadControl("somepath.ascx");
control.MyFunction();

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

Karl

Signature

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!)

> Hi,
>
[quoted text clipped - 5 lines]
>
> Jim.
Jim - 20 Jul 2005 15:34 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.