since the
newfileuploadcontrol
is
null
, and trying to access any of its
properties
or
methods
will result in
null reference exception
validate for
null
values before accessing the properties
if(newfileuploadcontrol!= null)
if (newfileuploadcontrol.HasFile)
Note:
this is just to by pass the null reference error, but you will only have to find the actual cause for null values in the object which you expect something.