Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing Page object from a nested Custom Control
Message
De
22/08/2005 14:08:19
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Librairie contrôle Web
Titre:
Referencing Page object from a nested Custom Control
Divers
Thread ID:
01042706
Message ID:
01042706
Vues:
64
I have created an ASP.NET Custom Control which renders as a LinkButton. This control works properly when placed directly on a web form.

However, When I try to instantiate the custom LinkButton control in another Custom Control as a child control, I get the following error when the controls are rendered:

System.NullReferenceException: Object reference not set to an instance of an object.

This error occurs in the overridden Render method in the child LinkButton Custom Control. The object being referenced is the Page object in the following line of code from the Render method:
output.Write("<a  id=\"" + this.UniqueID + "\" href=\"javascript:" + this.Page.GetPostBackEventReference(this) +"\">");
For some reason the Page object is not found when the custom control is instantiated in a parent Custom Control.

Does anyone know what I am missing here and how to resolve this issue?

Thanks,
Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Répondre
Fil
Voir

Click here to load this message in the networking platform