user control public method- HELP!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SlA=?=

    #1

    user control public method- HELP!

    I have a series of users controls on a single ASPX page. These control are
    loaded into PlaceHolders via LoadControl(). For simplistic sake, let’s say I
    have UC1 and UC2.

    UC1 contains a public method called UpdateFromThisC ontrol that sets the
    values of several Labels on UC1

    UC2 needs to fire the public method of UC1 in some situations. In order to
    access UC1’s public method I added a reference in UC2

    <%@ Reference VirtualPath="~/controls/UC1.ascx" %>

    And I used the following C# to gain access to that public method:

    UC1 updatecontrol = new UC1();
    updatecontrol.U pdateFromThisCo ntrol ();

    Im abole to see the method in the intellisense and do a trace to ensure its
    steping into UC1. But it always blows up when trying to execute the first
    line of the public method. Object reference not set to an instance of an
    object. Even if it’s just a simple Response.write( )

    Any assistance appreciated

    --
    JP
    ..NET Software Developer
Working...