Object references from aspx to C#

Discussion in 'ASP .Net Web Controls' started by Iza, Jul 18, 2007.

  1. Iza

    Iza Guest

    Hi

    I'm trying to instantiate 2 UserControls in an aspx page:
    ....
    <MyNamespace:MyControl1 ID="ctrl1" runat="server" ParentWindow="<%#
    this %>" />
    <MyNamespace:MyControl2 ID="ctrl2" runat="server" Args="<%# ctrl1
    %>" />
    ....

    I have 2 corresponding classes with their public properties
    ParentWindow and Args respectively.
    Now, what happens is that the classes are instantiated and
    variables "this" and "ctrl1" are correctly initialized in aspx but
    they are null when referenced in class properties. Why?

    I would appreciate any ideas.
    The objects are required to be created in this manner, in ASPX page,
    so instatiating them in C# code is not an option.
    Iza, Jul 18, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John M
    Replies:
    1
    Views:
    1,107
    Kumar Reddi
    May 29, 2005
  2. Roger Leigh
    Replies:
    8
    Views:
    413
    Karl Heinz Buchegger
    Nov 17, 2003
  3. Iza
    Replies:
    0
    Views:
    346
  4. mAbZ
    Replies:
    2
    Views:
    464
  5. Jack Bates
    Replies:
    3
    Views:
    294
    Steven D'Aprano
    Aug 6, 2011
Loading...

Share This Page