This is a migrated thread and some comments may be shown as answers.

How to access dynamically created UserControls in dynamically created Docks

2 Answers 111 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Fredrik
Top achievements
Rank 1
Fredrik asked on 20 May 2011, 12:48 PM
Hello!

I'm working on a Dock project pretty much based on the My Portal demo. I'm creating different docks containing different UserControls (for example textboxes, radiobuttonlists). The same type of usercontrol docks can be created multiple times, but my problem has to do with accessing the usercontrol docks on a button event in code behind.

Example of how I want it to work
- I create 3 docks all based on a usercontrol containing a simple textbox,
- Put text in the three textboxes (all in different docks)
- Click Save Button
- Get access to the different textboxes in my codebehind file.

The problem right now is that I can't get hold of the values in the dynamically created docks.

Thanks / Fredrik

2 Answers, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 23 May 2011, 03:38 PM
Hello Fredrik,

The easiest way to get the textbox values in the code behind is by finding the respective textbox controls. Firstly you should get a reference to the dock's user control, and for this task you need to set ID to it. After we have a reference to the user control, we can use its FindControl method to get a reference to any control in the UserControl.
I have modified the MyPortal demo to show this behavior. It is attached to the thread. When running it add the ExchangeRates Widget and then press the "Save" button.

Regards,
Pero
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Fredrik
Top achievements
Rank 1
answered on 24 May 2011, 08:22 AM
Works fine now! Thanks!
Tags
Dock
Asked by
Fredrik
Top achievements
Rank 1
Answers by
Pero
Telerik team
Fredrik
Top achievements
Rank 1
Share this question
or