Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dynamic UserControls and delegates

Posted on 2004-10-27
8
Medium Priority
?
468 Views
Last Modified: 2008-03-10
How does one gain access to delegate within a dynamically loaded usercontrol.  Here is short snippet of code:

        Dim ctlControl As UserControl
        ctlControl = LoadControl("~/FolderName/TomsTree.ascx")
        PlaceHolder1.Controls.Add(ctlControl)

        ctlControl = LoadControl("~/FolderName/MyDataGrid.ascx")
        PlaceHolder1.Controls.Add(ctlControl)

TomsTree has a delegate that needs to communicate with MyDataGrid when an event occurs.  This works perfectly if I declare the controls at design time...but how would I add an event handler and addressof to dynamically loaded controls such as this?
       
0
Comment
Question by:awiinc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 1

Accepted Solution

by:
EugeneTrukhin earned 500 total points
ID: 12426165
just a comment: may be through reflection?
0
 
LVL 2

Author Comment

by:awiinc
ID: 12426400
Thank you Eugene, but I did figure it out by finding a control and then referencing the event: see below.

Dim obj1 As ucWithDelegate = CType(PlaceHolder1.FindControl("NameOfControlToFind1"),ucWithDelegate)
Dim obj2 As uclisteningforDelegate = CType(PlaceHolder1.FindControl("NameOfControlToFind2"), uclisteningforDelegate)
AddHandler obj1.CategoryChanged, AddressOf obj2.CategoryChanged
0
 
LVL 1

Expert Comment

by:EugeneTrukhin
ID: 12426424
nice, it is good to know!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Author Comment

by:awiinc
ID: 12426509
How do I award EugeneTrukhin 100 points for responding.  I would like to delete this question from ASP.NET since I have figured the problem out without receiving an answer.  If this is not possible then just award Eugene all 250 points.
0
 
LVL 1

Expert Comment

by:EugeneTrukhin
ID: 12426532
i think moderator can delete this topic.
0
 
LVL 1

Expert Comment

by:EugeneTrukhin
ID: 12426535
or u can award yourself :)
0
 
LVL 2

Author Comment

by:awiinc
ID: 12426541
Can he delete and award you 100 points for responding?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question