A
Andrew Robinson
I have a user control that I am dynamically loading at run time:
PersonalInformationUserControl pi = new PersonalInformationUserControl();
PlaceHolderPersonalInformation.Controls.Add(pi);
My user control has public properties that in turn access controls on the
UC. I can access the properties, but the subsequent access to the underlying
controls generates a null reference exception. How do I get the control to
build / load all of its content?
pi.DisplayOnly = true; // ok
pi.Email = "(e-mail address removed)"; // null ref on the TextBoxEmail control
within the PI control:
public string Email
{
get { return TextBoxEmail.Text; }
set { TextBoxEmail.Text = value; }
}
Thanks,
PersonalInformationUserControl pi = new PersonalInformationUserControl();
PlaceHolderPersonalInformation.Controls.Add(pi);
My user control has public properties that in turn access controls on the
UC. I can access the properties, but the subsequent access to the underlying
controls generates a null reference exception. How do I get the control to
build / load all of its content?
pi.DisplayOnly = true; // ok
pi.Email = "(e-mail address removed)"; // null ref on the TextBoxEmail control
within the PI control:
public string Email
{
get { return TextBoxEmail.Text; }
set { TextBoxEmail.Text = value; }
}
Thanks,