I'm currently trying to set a hidden field value which is located on a master page. I am trying to set this value from a asc.vb file which is located on my child page
ascx.vb:
Dim PortalReq as New HiddenField()
portalReq.ID = "portalReq"
portalReq.Value = "aaaaa"
TryCast(Me.Page.FindControl("aspnetForm"),HtmlForm).Control.Add(portalReq)
When I run this page an error comes up with "Object reference not set to an instance of an object"
I have looked on forums for information about this problem and can't seem to fix this. Can anyone help?
Use Me.Page.Master.FindControl instead of Me.Page.FindControl