Page Lifecycle - Using FindControl to reference a control created programatically during page load
- by Jay Wilde
Hi,
I'm creating some text boxes on my form programatically which I need to reference later using FindControl.
I've put the FindControl instruction in the page load method after the code which creates them but get an error:
"Object reference not set to an instance of an object."
I assume this is because the textbox controls are not created until later in the lifecycle and therefore cannot be referenced from within Page_Load.
Can someone advise where in my code-behind I would need to place the FindControl instruction so that it can find these programatically created text boxes?