S
shapper
Hello,
I added a content place holder (ID="cphContent") to a master page.
Now I need to add controls to that content place holder in the pages
which use that master page.
I am doing it at runtime as follows
Dim cphContent As ContentPlaceHolder =
CType(Page.FindControl("cphContent"), ContentPlaceHolder)
Dim MyLabel As New Label
AddHandler MyLabel.Init, AddressOf MyLabel_Init
cphContent.Controls.Add(MyLabel)
I am getting an error:
"System.NullReferenceException: Object reference not set to an
instance of an object."
I think I am getting the error because my the cphContent content place
holder is not found.
Could you tell me how to solve this?
Thanks,
Miguel
I added a content place holder (ID="cphContent") to a master page.
Now I need to add controls to that content place holder in the pages
which use that master page.
I am doing it at runtime as follows
Dim cphContent As ContentPlaceHolder =
CType(Page.FindControl("cphContent"), ContentPlaceHolder)
Dim MyLabel As New Label
AddHandler MyLabel.Init, AddressOf MyLabel_Init
cphContent.Controls.Add(MyLabel)
I am getting an error:
"System.NullReferenceException: Object reference not set to an
instance of an object."
I think I am getting the error because my the cphContent content place
holder is not found.
Could you tell me how to solve this?
Thanks,
Miguel