Update ASCX from ASPX using delegates
<p>I am trying to separate all DB calls required by ASCX.cs to call only from ASPX.cs, I am trying it with delegate and events.</p>

<p>my ASCX.cs has </p>

<pre><code>namespace x.xx.xy.xyy.xyyy
{
public partial class PaymentItem : UserControlBase
{      
    public delegate void Handler(Dictionary&lt;string, string&gt; keyvalues);
    public event Handler aPICall;     
}
}
</code></pre>

<p>my ASPX.cs has</p>

<pre><code>namespace x.xx.xz.xzz.xzzz
{
public partial class PaymentItemPopUp
{
    protected global::x.xx.xy.xyy.xyyy.PaymentItem ucPaymentItem;

    protected void Page_Load(object sender, EventArgs e)
    {
        this.ucPaymentItem.aPICall += new PaymentItem.Handler(ServiceAPICAll);

    }
protected void ServiceAPICAll(Dictionary&lt;string, string&gt; keyvalues){

}
}
}
</code></pre>

<p>I am getting 'Object reference not set to an instance of an object' when compiler hits the following line 
this.ucPaymentItem.aPICall += new PaymentItem.Handler(ServiceAPICAll);</p>

<p>I suppose the issue from the following line </p>

<p>protected global::x.xx.xy.xyy.xyyy.PaymentItem ucPaymentItem;</p>

<p>any idea?</p>
