[CLOSED] Adding UserControl dynamically in code-behind

Page 3 of 3 FirstFirst 123
  1. #21
    Hi,

    And that I have seen that the Constructor-approach has been used in many examples here on the forum as well as on your examples page...
    Can you provide a link on an example where we instantiate user control via constructor?
  2. #22
    Sorry, my bad. The example used LoadControl =)

    However, in previous posts in this thread I was told that using the Constructor should work.

    I have since solved the problem after switching to using LoadControl, but its good to know that using the Constructor does not work =)
  3. #23
    @wagger, thanks for posting responses.

    It was the new for me that a constructor and .LoadControl() works by the different ways. Thanks, Vladimir:)

    But one thing I still don't understand why these samples work with the constructors on my and Geoffrey's sides. Hope, I will have some time to investigate further:)

    Vladimir assumed that Asp.Net caching can cause the issue, in other words the class was instantiated by .LoadControl(), then it, he assumed, works with a constructor. I was unable to reproduce it after some quick tests.

    Just to clarify: @wagger, what .Net are you using?
  4. #24
    Hey Daniil,

    I am using .NET 4.0 for this project in Visual Studio 2010. I am normally using Chrome, but test every now and then in FF and IE too. The version numbers of the browsers you can see in previous post.

    Thanks again. Y'all doing a great job with the support on this forum!
  5. #25
    Thanks.

    I looked it up on the internet and found these threads:
    http://forums.asp.net/p/1105174/1699211.aspx
    http://www.pcreview.co.uk/forums/loa...-t1257732.html

    They answer why LoadControl and not a constructor.
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 14
    Last Post: Nov 16, 2012, 10:01 AM
  2. [CLOSED] Managing events from a dynamically loaded UserControl
    By egvt in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 20, 2012, 4:49 PM
  3. Replies: 4
    Last Post: Jul 07, 2011, 12:40 PM
  4. Replies: 2
    Last Post: Oct 04, 2010, 7:36 AM
  5. Replies: 3
    Last Post: Mar 30, 2010, 1:03 PM

Tags for this Thread

Posting Permissions