This article deals with validating the FileUpload control which is inside a GridView control.
Introduction
As per the requirement of one of the DNF friend's, I am presenting this article in which we will be validating a file upload control which is inside a grid view control.
Let us take a scenario where we have a gridview in that we have a checkbox column and one file upload controls column and a common submit button outside gridview. And in this if we check a rows checkbox and we need to check whether the file upload control contains any value or not. if checkbox is checked and file upload control contains values then we will do some task and if not means we will alert a message.
So lets start with our sample...
Step1 - Open Visual studio and add new website project.
Step 2 – Rightclick on the project -> add new item -> Select xml file -> Name it as Data1.xml we are simply add this to populate with the serial numbers in the grid, and this you can achieve in any other way you like.

Step 3 - Add a new Gridview to the aspx page and add two template fields one for the checkbox and one for the fileupload control. And design as shown below

Step 4 - The ASPX source will have the gridview content as below

Step 5 - Load the data from xml to grid view on page load

Step 6 - On RowDataBound of the grid view we need to register client side array declaration for the checkbox and fileupload control respectively.

Step 7 - Now we have to add our validation logic into a javascript function

Step 8 - Build and run your application. Select a checkbox without selecting a file and click on check button. You will a popup message as shown below. If file is selected then the page posts back and you need to add the logic for storing data into DB

Thats it!
Hope you like this article, let me know your thoughts and comments.