How to access dynamically created UserControls in dynamically created Docks

3 posts, 1 answers
  1. Fredrik
    Fredrik avatar
    2 posts
    Member since:
    May 2011

    Posted 20 May 2011 Link to this post


    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. Answer
    Pero avatar
    1156 posts

    Posted 23 May 2011 Link to this post

    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.

    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.

  3. DevCraft R3 2016 release webinar banner
  4. Fredrik
    Fredrik avatar
    2 posts
    Member since:
    May 2011

    Posted 24 May 2011 Link to this post

    Works fine now! Thanks!
Back to Top