[Solved] FileUpload Error? [duplicate]


You cannot find a control in the GridView directly when its in the row, you have to find it in the row of the gridview.

Use either:
GridView1_RowDataBound event

if(e.Row.RowType == DataControlRowType.DataRow)
    {
        FileUpload fileupload = 
(FileUpload)e.Row.FindControl("fileupload1");
    }

OR

 DataRow r = (DataRow)sender;
 FileUpload fileupload = (FileUpload)r.FindControl("fileupload1");

solved FileUpload Error? [duplicate]