I am trying to dynamically create controls and give them properties during run time.
I have put my code inside the Page_Init event, when I run my website I can see m
try to put your code in the Page_Load instead of Page_Init and also, check for null before using objects returned by FindControl.
I suspect the object InputTextBox is null and it crashes when you try to print its Text.
as a general rule just check for null and also for type when casting results of FindControl to something else.